Closed jfradj closed 1 year ago
The following code replacement will fix the issue.
// Overwrite default settings with environment specific local settings
$configFiles = [
__DIR__ . "/local.{$_ENV['APP_ENV']}.php",
__DIR__ . '/env.php',
__DIR__ . '/../../env.php',
];
foreach ($configFiles as $configFile) {
if (!file_exists($configFile)) {
continue;
}
$local = require $configFile;
if (is_callable($local)) {
$settings = $local($settings);
}
}
Thanks for the feedback. Your approach looks good. I will check it.
It should be fixed now. Please check the changes and give me feedback.
Close this as fixed.
Hello,
https://odan.github.io/slim4-skeleton/configuration.html
states that:Which is not correct. The PHP
glob()
function used, returns file paths alphabetically ordered, thus the secret credentials file (env.php
) will be loaded BEFORE the environment specific file (local.{env}.php
)I think the issue isn't really in the documentation page, since it's the expected behavior. The issue is in the
config/settings.php
file using the glob function thus loosing any kind of control on the load orderingRegards, Johann