feat: dynamische APP_URL detectie voor fociz.nl op main, verwijder uw-domein placeholders
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# Zorg dat omgevingsspecifieke bestanden nooit worden overschreven bij merges tussen dev en main
|
||||
config/config.php merge=ours
|
||||
includes/env_badge.php merge=ours
|
||||
config/.env.example merge=ours
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ DB_PORT="3306"
|
||||
DB_NAME="fociz"
|
||||
DB_USER="uw_mariadb_gebruiker"
|
||||
DB_PASS="uw_mariadb_wachtwoord"
|
||||
APP_URL="https://uw-domein.nl"
|
||||
APP_URL="https://fociz.nl"
|
||||
```
|
||||
|
||||
### 3. Automatische Tabellen Aanmaak
|
||||
@@ -90,7 +90,7 @@ U hoeft **niet** handmatig SQL-commando's uit te voeren: zodra u de website voor
|
||||
*(Optioneel kunt u `config/schema.sql` ook zelf importeren via phpMyAdmin of de MariaDB CLI).*
|
||||
|
||||
### 4. Eerste Beheerder Instellen
|
||||
1. Open uw browser en ga naar `https://uw-domein.nl`.
|
||||
1. Open uw browser en ga naar `https://fociz.nl` (of `https://dev.fociz.nl`).
|
||||
2. U wordt automatisch doorverwezen naar `/auth/setup.php`.
|
||||
3. Vul uw naam, e-mailadres en gewenst wachtwoord in.
|
||||
4. Scan de QR-code met Google Authenticator of Microsoft Authenticator.
|
||||
|
||||
+3
-4
@@ -6,10 +6,10 @@ DB_USER="focizlive_user"
|
||||
DB_PASS="F0c1z_Live_Secure_2026!"
|
||||
|
||||
# Omgeving: 'development' (knippert rood) of 'live' (knippert groen)
|
||||
APP_ENV="development"
|
||||
APP_ENV="live"
|
||||
|
||||
# Applicatie URL (voor uitnodigingslinks)
|
||||
APP_URL="https://uw-domein.nl"
|
||||
# Applicatie URL (voor uitnodigingslinks en OAuth redirects: https://fociz.nl)
|
||||
APP_URL="https://fociz.nl"
|
||||
|
||||
# Applicatie Geheime Sleutel (willekeurige tekenreeks)
|
||||
APP_SECRET="fociz-maria-db-super-secret-key-998877"
|
||||
@@ -23,4 +23,3 @@ MICROSOFT_TENANT_ID="common"
|
||||
JIRA_DOMAIN=""
|
||||
JIRA_EMAIL=""
|
||||
JIRA_API_TOKEN=""
|
||||
|
||||
|
||||
+27
-2
@@ -73,11 +73,36 @@ define('DB_USER', fociz_env('DB_USER', 'focizlive_user'));
|
||||
define('DB_PASS', fociz_env('DB_PASS', '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 {
|
||||
$envUrl = fociz_env('APP_URL');
|
||||
if (!empty($envUrl) && !str_contains($envUrl, 'uw-domein.nl')) {
|
||||
return rtrim($envUrl, '/');
|
||||
}
|
||||
|
||||
// Dynamische detectie op basis van het huidige domein (werkt direct op fociz.nl én dev.fociz.nl)
|
||||
if (!empty($_SERVER['HTTP_HOST'])) {
|
||||
$isHttps = (
|
||||
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
|
||||
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') ||
|
||||
(!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on') ||
|
||||
(isset($_SERVER['SERVER_PORT']) && (int)$_SERVER['SERVER_PORT'] === 443)
|
||||
);
|
||||
$scheme = $isHttps ? 'https://' : 'http://';
|
||||
return $scheme . $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
|
||||
// Standaard fallback per omgeving
|
||||
return (defined('APP_ENV') && APP_ENV === 'live') ? 'https://fociz.nl' : 'https://dev.fociz.nl';
|
||||
}
|
||||
}
|
||||
|
||||
// Applicatie instellingen (Live defaults)
|
||||
define('APP_NAME', 'Fociz');
|
||||
define('APP_URL', fociz_env('APP_URL', ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://') . ($_SERVER['HTTP_HOST'] ?? 'fociz.nl'))));
|
||||
define('APP_SECRET', fociz_env('APP_SECRET', 'fociz-maria-db-super-secret-key-998877'));
|
||||
define('APP_ENV', fociz_env('APP_ENV', 'live')); // 'live' voor de main branch
|
||||
define('APP_URL', fociz_detect_app_url());
|
||||
define('APP_SECRET', fociz_env('APP_SECRET', 'fociz-maria-db-super-secret-key-998877'));
|
||||
|
||||
// Tijdzone
|
||||
date_default_timezone_set('Europe/Amsterdam');
|
||||
|
||||
Reference in New Issue
Block a user