Make config.php environment-aware with smart host detection, normalize .gitattributes, and use dynamic APP_URL in Outlook integrations

This commit is contained in:
2026-09-09 17:58:19 +02:00
parent ed5bd6f998
commit dfaa8ba7a8
3 changed files with 42 additions and 14 deletions
+27 -12
View File
@@ -69,22 +69,37 @@ if (!function_exists('fociz_env')) {
}
// =========================================================================
// 2. CENTRALE DATABASE CONFIGURATIE (DE ENIGE BRON VAN WAARHEID)
// =========================================================================
define('DB_HOST', fociz_env('DB_HOST', '192.168.2.33'));
define('DB_PORT', fociz_env('DB_PORT', '3306'));
define('DB_NAME', fociz_env('DB_NAME', 'fociz'));
define('DB_USER', fociz_env('DB_USER', 'focizlive_user'));
define('DB_PASS', fociz_env('DB_PASS', 'F0c1z_Live_Secure_2026!'));
define('DB_CHARSET', 'utf8mb4');
// =========================================================================
// 3. APPLICATIE INSTELLINGEN & OMGEVING
// 2. APPLICATIE INSTELLINGEN & OMGEVINGSDETECTIE
// =========================================================================
define('APP_NAME', 'Fociz');
define('APP_ENV', fociz_env('APP_ENV', 'live')); // 'live' of 'development'
// Automatische omgevingsdetectie:
// 1. Expliciete .env variabele 'APP_ENV'
// 2. Automatisch 'development' indien hostname 'dev.' of 'localhost' bevat
// 3. Standaard 'live'
$detectedHost = $_SERVER['HTTP_HOST'] ?? '';
$isDevHost = (
str_contains($detectedHost, 'dev.') ||
str_contains($detectedHost, 'localhost') ||
str_contains($detectedHost, '127.0.0.1')
);
$defaultEnv = $isDevHost ? 'development' : 'live';
define('APP_ENV', fociz_env('APP_ENV', $defaultEnv));
define('APP_SECRET', fociz_env('APP_SECRET', 'fociz-maria-db-super-secret-key-998877'));
// =========================================================================
// 3. CENTRALE DATABASE CONFIGURATIE (OMGEVINGSAFHANKELIJK & GIT-VEILIG)
// =========================================================================
// Leest eerst eventuele .env variabelen (die per server uniek en gitignored zijn).
// Indien niet ingesteld via .env, wordt automatisch de juiste database gekozen op basis van APP_ENV.
$isDevEnv = (APP_ENV === 'development');
define('DB_HOST', fociz_env('DB_HOST', '192.168.2.33'));
define('DB_PORT', fociz_env('DB_PORT', '3306'));
define('DB_NAME', fociz_env('DB_NAME', $isDevEnv ? 'focizdev' : 'fociz'));
define('DB_USER', fociz_env('DB_USER', $isDevEnv ? 'focizdev_user' : 'focizlive_user'));
define('DB_PASS', fociz_env('DB_PASS', $isDevEnv ? 'F0c1z_Dev_Secure_2026!' : 'F0c1z_Live_Secure_2026!'));
define('DB_CHARSET', 'utf8mb4');
// Bepaal de dynamische of geconfigureerde applicatie URL
if (!function_exists('fociz_detect_app_url')) {
function fociz_detect_app_url(): string {