First Commit
This commit is contained in:
commit
923d6ca242
35 changed files with 4933 additions and 0 deletions
13
src/php/Environment/DiscordEnvironment.php
Normal file
13
src/php/Environment/DiscordEnvironment.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop\Environment;
|
||||
|
||||
final readonly class DiscordEnvironment
|
||||
{
|
||||
public function __construct(
|
||||
public string $clientId,
|
||||
public string $clientSecret,
|
||||
public string $loginUrl,
|
||||
) {}
|
||||
}
|
28
src/php/Environment/EnvironmentHandler.php
Normal file
28
src/php/Environment/EnvironmentHandler.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop\Environment;
|
||||
|
||||
use DotenvVault\DotenvVault;
|
||||
use GamesShop\Paths;
|
||||
|
||||
final class EnvironmentHandler
|
||||
{
|
||||
private const string ENVIRONMENT_PATH = Paths::ROOT_PATH . '/config';
|
||||
|
||||
public function load() {
|
||||
$dotEnv = DotenvVault::createImmutable(
|
||||
self::ENVIRONMENT_PATH
|
||||
);
|
||||
|
||||
$dotEnv->safeLoad();
|
||||
}
|
||||
|
||||
public function getDiscordEnvironment(): DiscordEnvironment {
|
||||
return new DiscordEnvironment(
|
||||
$_SERVER['DISCORD_CLIENT_ID'],
|
||||
$_SERVER['DISCORD_CLIENT_SECRET'],
|
||||
$_SERVER['DISCORD_CLIENT_LOGIN_URI'],
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue