Compare commits
11 Commits
dev
...
9de4c3b1d2
| Author | SHA1 | Date | |
|---|---|---|---|
| 9de4c3b1d2 | |||
| 677126e7f6 | |||
| 333e9c2451 | |||
| ce7b2762df | |||
| d11f11c2c8 | |||
| 262a8f8b42 | |||
| 68c0d9fe60 | |||
| 2b94f3dd46 | |||
| 8dbd0b251f | |||
| a09d99ea88 | |||
| 434df2754c |
@@ -1,5 +0,0 @@
|
||||
# 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
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# MariaDB Verbinding
|
||||
DB_HOST="192.168.2.33"
|
||||
DB_PORT="3306"
|
||||
<<<<<<< HEAD
|
||||
DB_NAME="focizdev"
|
||||
DB_USER="focizdev_user"
|
||||
DB_PASS="F0c1z_Dev_Secure_2026!"
|
||||
|
||||
# Omgeving: 'development' (knippert rood) of 'live' (knippert groen)
|
||||
APP_ENV="development"
|
||||
|
||||
# Applicatie URL (voor uitnodigingslinks en OAuth redirects: https://dev.fociz.nl of https://fociz.nl)
|
||||
APP_URL="https://dev.fociz.nl"
|
||||
=======
|
||||
DB_NAME="fociz"
|
||||
DB_USER="focizlive_user"
|
||||
DB_PASS="F0c1z_Live_Secure_2026!"
|
||||
|
||||
# Omgeving: 'development' (knippert rood) of 'live' (knippert groen)
|
||||
APP_ENV="live"
|
||||
|
||||
# Applicatie URL (voor uitnodigingslinks en OAuth redirects: https://dev.fociz.nl of https://fociz.nl)
|
||||
APP_URL="https://www.fociz.nl"
|
||||
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
|
||||
|
||||
# Applicatie Geheime Sleutel (willekeurige tekenreeks)
|
||||
APP_SECRET="fociz-maria-db-super-secret-key-998877"
|
||||
|
||||
# Microsoft 365 / Outlook (Optionele globale defaults; kan ook via web UI worden ingesteld)
|
||||
MICROSOFT_CLIENT_ID=""
|
||||
MICROSOFT_CLIENT_SECRET=""
|
||||
MICROSOFT_TENANT_ID="common"
|
||||
|
||||
# Atlassian Jira Cloud (Optionele globale defaults; kan ook via web UI worden ingesteld)
|
||||
JIRA_DOMAIN=""
|
||||
JIRA_EMAIL=""
|
||||
JIRA_API_TOKEN=""
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Fociz Applicatie- en Databaseconfiguratie
|
||||
* Laadt automatisch .env (of .env.example indien .env niet bestaat)
|
||||
*/
|
||||
|
||||
$envVars = [];
|
||||
|
||||
// 1. Zoek naar .env of val terug op config/.env.example
|
||||
$envCandidates = [
|
||||
__DIR__ . '/../.env',
|
||||
__DIR__ . '/.env.example',
|
||||
__DIR__ . '/../.env.example',
|
||||
];
|
||||
|
||||
foreach ($envCandidates as $envFile) {
|
||||
if (file_exists($envFile)) {
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
if ($lines !== false) {
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
// Negeer lege regels en commentaarregels (# of //)
|
||||
if ($line === '' || str_starts_with($line, '#') || str_starts_with($line, '//')) {
|
||||
continue;
|
||||
}
|
||||
if (strpos($line, '=') !== false) {
|
||||
list($name, $value) = explode('=', $line, 2);
|
||||
$name = trim($name);
|
||||
$value = trim($value);
|
||||
// Verwijder omlijstende aanhalingstekens (" of ')
|
||||
$value = trim($value, " \t\n\r\0\x0B\"'");
|
||||
|
||||
// Sla op in array en zet in globale PHP variabelen
|
||||
$envVars[$name] = $value;
|
||||
$_ENV[$name] = $value;
|
||||
$_SERVER[$name] = $value;
|
||||
@putenv("{$name}={$value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
break; // Stop zodra we het eerste geldige bestand hebben ingeladen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Veilige helper om een omgevingsvariabele op te vragen
|
||||
*/
|
||||
if (!function_exists('fociz_env')) {
|
||||
function fociz_env(string $key, $default = null) {
|
||||
global $envVars;
|
||||
if (isset($envVars[$key]) && $envVars[$key] !== '') {
|
||||
return $envVars[$key];
|
||||
}
|
||||
if (isset($_ENV[$key]) && $_ENV[$key] !== '') {
|
||||
return $_ENV[$key];
|
||||
}
|
||||
if (isset($_SERVER[$key]) && $_SERVER[$key] !== '') {
|
||||
return $_SERVER[$key];
|
||||
}
|
||||
$val = @getenv($key);
|
||||
if ($val !== false && $val !== '') {
|
||||
return $val;
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
// MariaDB Verbindingsgegevens (uit .env of .env.example)
|
||||
define('DB_HOST', fociz_env('DB_HOST', '192.168.2.33'));
|
||||
define('DB_PORT', fociz_env('DB_PORT', '3306'));
|
||||
<<<<<<< HEAD
|
||||
define('DB_NAME', fociz_env('DB_NAME', 'focizdev'));
|
||||
define('DB_USER', fociz_env('DB_USER', 'focizdev_user'));
|
||||
define('DB_PASS', fociz_env('DB_PASS', 'F0c1z_Dev_Secure_2026!'));
|
||||
=======
|
||||
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!'));
|
||||
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
|
||||
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');
|
||||
<<<<<<< HEAD
|
||||
if (!empty($envUrl) && !str_contains($envUrl, 'uw-domein.nl')) {
|
||||
=======
|
||||
if (!empty($envUrl) && !str_contains($envUrl, 'www.fociz.nl')) {
|
||||
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
|
||||
return rtrim($envUrl, '/');
|
||||
}
|
||||
|
||||
// Dynamische detectie op basis van het huidige domein (werkt direct op dev.fociz.nl én 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
|
||||
define('APP_NAME', 'Fociz');
|
||||
define('APP_ENV', fociz_env('APP_ENV', 'development')); // 'development' of 'live'
|
||||
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');
|
||||
|
||||
// Foutrapportage: in development tonen we fouten direct op het scherm
|
||||
if (APP_ENV !== 'live') {
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
}
|
||||
Reference in New Issue
Block a user