Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc5d4a027f | |||
| b3dfbf4406 | |||
| 939e0518df | |||
| 61043cd61c | |||
| 4f7db2ec83 | |||
| 795e41561c | |||
| 411fa79d7e |
+21
-18
@@ -25,27 +25,30 @@ if (!headers_sent()) {
|
|||||||
}
|
}
|
||||||
@ini_set('expose_php', 'off');
|
@ini_set('expose_php', 'off');
|
||||||
|
|
||||||
// 1. Optionele .env inlezing uit de hoofdmap (uitsluitend .env, GEEN .env.example fallback)
|
// 1. .env inlezing (controleert zowel config/.env als hoofdmap .env)
|
||||||
$envVars = [];
|
$envVars = [];
|
||||||
$envFile = __DIR__ . '/../.env';
|
$envLocations = [__DIR__ . '/.env', __DIR__ . '/../.env'];
|
||||||
if (file_exists($envFile)) {
|
foreach ($envLocations as $envFile) {
|
||||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
if (file_exists($envFile)) {
|
||||||
if ($lines !== false) {
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
foreach ($lines as $line) {
|
if ($lines !== false) {
|
||||||
$line = trim($line);
|
foreach ($lines as $line) {
|
||||||
if ($line === '' || str_starts_with($line, '#') || str_starts_with($line, '//')) {
|
$line = trim($line);
|
||||||
continue;
|
if ($line === '' || str_starts_with($line, '#') || str_starts_with($line, '//')) {
|
||||||
}
|
continue;
|
||||||
if (strpos($line, '=') !== false) {
|
}
|
||||||
list($name, $value) = explode('=', $line, 2);
|
if (strpos($line, '=') !== false) {
|
||||||
$name = trim($name);
|
list($name, $value) = explode('=', $line, 2);
|
||||||
$value = trim($value, " \t\n\r\0\x0B\"'");
|
$name = trim($name);
|
||||||
$envVars[$name] = $value;
|
$value = trim($value, " \t\n\r\0\x0B\"'");
|
||||||
$_ENV[$name] = $value;
|
$envVars[$name] = $value;
|
||||||
$_SERVER[$name] = $value;
|
$_ENV[$name] = $value;
|
||||||
@putenv("{$name}={$value}");
|
$_SERVER[$name] = $value;
|
||||||
|
@putenv("{$name}={$value}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break; // Eerste gevonden .env bestand is leidend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user