f22c5ebbfe
- PHP/MySQL Backend (XAMPP + Produktionsserver) - Front-Controller, API-Endpunkte, Session-Management - Flussmanagement-Simulation (Echtzeit, Punkt-basierter Fluss) - Stadt & Raumplanung (Prototyp, Top-Down Kachelsystem) - Klimawaechter 3D: Deiche kleiner, Baeume kippen, Budget angepasst - persistence.ts: Dualer Speicher (localStorage + Server-API) - 6 Unit-Test-Dateien fuer bestehende Simulationen Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* GeoGraSim — App Configuration
|
|
* Umgebungserkennung und Grundkonstanten
|
|
*/
|
|
|
|
// Umgebungserkennung via Hostname
|
|
define('IS_PRODUCTION', isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] !== 'localhost');
|
|
define('BASE_PATH', '/geograsim/App');
|
|
define('BASE_URL', (IS_PRODUCTION ? 'https://www.staatsgeheimnis.at' : 'http://localhost') . BASE_PATH);
|
|
define('APP_ROOT', dirname(__DIR__, 2));
|
|
|
|
// .env laden
|
|
$envFile = IS_PRODUCTION
|
|
? APP_ROOT . '/.env.production'
|
|
: APP_ROOT . '/.env.local';
|
|
|
|
if (file_exists($envFile)) {
|
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
|
foreach ($lines as $line) {
|
|
$line = trim($line);
|
|
if ($line === '' || $line[0] === '#') continue;
|
|
if (strpos($line, '=') === false) continue;
|
|
[$key, $value] = explode('=', $line, 2);
|
|
$key = trim($key);
|
|
$value = trim($value);
|
|
if (!defined($key)) {
|
|
define($key, $value);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Defaults fuer lokale Entwicklung (XAMPP)
|
|
if (!defined('DB_HOST')) define('DB_HOST', 'localhost');
|
|
if (!defined('DB_NAME')) define('DB_NAME', 'geograsim');
|
|
if (!defined('DB_USER')) define('DB_USER', 'root');
|
|
if (!defined('DB_PASS')) define('DB_PASS', '');
|
|
if (!defined('DB_PORT')) define('DB_PORT', '3306');
|