I rightly do not know what this all is
This commit is contained in:
parent
af6b2b752e
commit
287c1f67c5
78 changed files with 3484 additions and 3365 deletions
|
@ -1,21 +1,21 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop\Environment;
|
||||
|
||||
final readonly class DatabaseEnvironment
|
||||
{
|
||||
public function __construct(
|
||||
public string $driver,
|
||||
public string $path
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function getDoctrineConfig() {
|
||||
return [
|
||||
'driver' => $this->driver,
|
||||
'path' => $this->path
|
||||
];
|
||||
}
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop\Environment;
|
||||
|
||||
final readonly class DatabaseEnvironment
|
||||
{
|
||||
public function __construct(
|
||||
public string $driver,
|
||||
public string $path
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function getDoctrineConfig() {
|
||||
return [
|
||||
'driver' => $this->driver,
|
||||
'path' => $this->path
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,13 +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,
|
||||
) {}
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop\Environment;
|
||||
|
||||
final readonly class DiscordEnvironment
|
||||
{
|
||||
public function __construct(
|
||||
public string $clientId,
|
||||
public string $clientSecret,
|
||||
public string $loginUrl,
|
||||
) {}
|
||||
}
|
|
@ -1,40 +1,40 @@
|
|||
<?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'],
|
||||
);
|
||||
}
|
||||
|
||||
public function getDatabaseEnvironment(): DatabaseEnvironment
|
||||
{
|
||||
return new DatabaseEnvironment(
|
||||
$_SERVER['DB_DRIVER'],
|
||||
$_SERVER['DB_PATH']
|
||||
);
|
||||
}
|
||||
|
||||
public function isProduction(): bool {
|
||||
return $_SERVER['PRODUCTION'] === 'true';
|
||||
}
|
||||
<?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'],
|
||||
);
|
||||
}
|
||||
|
||||
public function getDatabaseEnvironment(): DatabaseEnvironment
|
||||
{
|
||||
return new DatabaseEnvironment(
|
||||
$_SERVER['DB_DRIVER'],
|
||||
$_SERVER['DB_PATH']
|
||||
);
|
||||
}
|
||||
|
||||
public function isProduction(): bool {
|
||||
return $_SERVER['PRODUCTION'] === 'true';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue