Files
listthingy-api/config/config.php
2025-12-12 21:22:48 +01:00

31 lines
697 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../src/Env.php';
use App\Env;
$envPath = __DIR__ . '/../.env';
if (file_exists($envPath)) {
Env::load($envPath);
}
$dbPath = Env::get('DB_PATH', 'db/database.sqlite');
if (!str_starts_with($dbPath, '/')) {
$dbPath = __DIR__ . '/../' . $dbPath;
}
return [
'db' => [
'path' => $dbPath,
],
'cors' => [
'allow_origin' => Env::get('CORS_ALLOW_ORIGIN', '*'),
'allow_methods' => Env::get('CORS_ALLOW_METHODS', 'GET, POST, PATCH, DELETE, OPTIONS'),
'allow_headers' => Env::get('CORS_ALLOW_HEADERS', 'Content-Type'),
],
'error_reporting' => Env::getBool('ERROR_REPORTING', true),
];