mail-account-admin/src/Settings.php

45 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace MailAccountAdmin;
class Settings
{
public function isDebugMode(): bool
{
return getenv('APP_DEBUG') === 'true';
}
public function getTimezone(): string
{
return 'Europe/Berlin';
}
public function getDateFormat(): string
{
// Default date format (https://www.php.net/manual/en/datetime.format.php)
// RFC 2822 formatted date (Thu, 21 Dec 2000 16:01:07 +0200)
return 'r';
}
public function getTwigSettings(): array
{
return [
'cache' => getenv('TWIG_CACHE_DIR') ?: false,
'debug' => $this->isDebugMode(),
'strict_variables' => getenv('TWIG_STRICT') === 'true',
];
}
public function getDatabaseSettings(): array
{
return [
'host' => getenv('DB_HOST') ?: 'localhost',
'port' => getenv('DB_PORT') ?: 3306,
'dbname' => getenv('DB_DATABASE') ?: '',
'username' => getenv('DB_USER') ?: '',
'password' => getenv('DB_PASSWORD') ?: '',
];
}
}