32 lines
1.3 KiB
PHP
32 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
$installedFile = __DIR__ . '/storage/install-config.php';
|
|
$installed = is_file($installedFile) ? require $installedFile : [];
|
|
if (!is_array($installed)) {
|
|
$installed = [];
|
|
}
|
|
|
|
$env = static function (string $key, mixed $fallback = null): mixed {
|
|
$value = getenv($key);
|
|
return $value === false || $value === '' ? $fallback : $value;
|
|
};
|
|
$db = is_array($installed['db'] ?? null) ? $installed['db'] : [];
|
|
|
|
return [
|
|
'installed' => is_file(__DIR__ . '/storage/installed.lock') && $db !== [],
|
|
'app_name' => (string) $env('APP_NAME', $installed['app_name'] ?? '欢乐水果机'),
|
|
'app_url' => rtrim((string) $env('APP_URL', $installed['app_url'] ?? ''), '/'),
|
|
'timezone' => (string) $env('APP_TIMEZONE', $installed['timezone'] ?? 'Asia/Shanghai'),
|
|
'db' => [
|
|
'driver' => 'mysql',
|
|
'host' => (string) $env('DB_HOST', $db['host'] ?? 'localhost'),
|
|
'port' => (string) $env('DB_PORT', $db['port'] ?? '3306'),
|
|
'database' => (string) $env('DB_DATABASE', $db['database'] ?? ''),
|
|
'username' => (string) $env('DB_USERNAME', $db['username'] ?? ''),
|
|
'password' => (string) $env('DB_PASSWORD', $db['password'] ?? ''),
|
|
'charset' => 'utf8mb4',
|
|
],
|
|
'session_name' => 'tanwan_session',
|
|
];
|