1e51ef7def
- Konzept/, didaktik_geografie/, didaktik_simulation/, v2-modules/, v2-platform/ - 12 code-workspace-Files - STATUS-*.md - viele M/D/R-Änderungen an bereits getrackten Files - .gitignore verstärkt: **/.humaninput/, **/secret_keys.txt Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* V2-Plattform — zentrale Konfiguration
|
|
*
|
|
* Lädt .env.local (falls vorhanden) und stellt Konstanten bereit.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
// .env.local laden (lokal)
|
|
$envFile = __DIR__ . '/../.env.local';
|
|
if (file_exists($envFile)) {
|
|
foreach (file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
|
|
$line = trim($line);
|
|
if ($line === '' || $line[0] === '#') continue;
|
|
if (!str_contains($line, '=')) continue;
|
|
[$k, $v] = array_map('trim', explode('=', $line, 2));
|
|
if (!getenv($k)) {
|
|
putenv("$k=$v");
|
|
$_ENV[$k] = $v;
|
|
}
|
|
}
|
|
}
|
|
|
|
function env(string $key, ?string $default = null): ?string {
|
|
$v = getenv($key);
|
|
return ($v === false || $v === '') ? $default : $v;
|
|
}
|
|
|
|
// DB
|
|
define('V2_DB_HOST', env('DB_HOST', 'localhost'));
|
|
define('V2_DB_PORT', (int) env('DB_PORT', '3306'));
|
|
define('V2_DB_NAME', env('DB_NAME', 'geograsim'));
|
|
define('V2_DB_USER', env('DB_USER', 'root'));
|
|
define('V2_DB_PASS', env('DB_PASS', ''));
|
|
|
|
// Auth
|
|
define('V2_JWT_SECRET', env('JWT_SECRET', 'change-me-locally'));
|
|
define('V2_JWT_TTL', (int) env('JWT_TTL_SECONDS', '14400'));
|
|
|
|
// Externe APIs (nur in tools/, nicht in api/)
|
|
define('V2_OPENAI_KEY', env('OPENAI_API_KEY', ''));
|
|
define('V2_ELEVENLABS_KEY', env('ELEVENLABS_API_KEY', ''));
|
|
|
|
// Pfade
|
|
define('V2_BASE_URL', env('V2_BASE_URL', 'http://localhost/geograsim/v2-platform'));
|
|
define('V2_ROOT', dirname(__DIR__));
|
|
|
|
// Logging
|
|
define('V2_LOG_LEVEL', env('LOG_LEVEL', 'info'));
|
|
define('V2_LOG_FILE', V2_ROOT . '/' . env('LOG_FILE', 'logs/v2-platform.log'));
|