New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding defaults #37
Comments
Would you be fine with making that an opt-in not default? |
After further reading of the code (I extended the class) I noticed that it's handled inside the loop. That got me thinking, that the api could be extended to allow custom processing of the file contents within that loop? I'm not sure if that isn't overthinking it though. An option to allow continuing the loop instead of breaking it would be ok though :D |
My workaround: $dotenvLoader = new josegonzalez\Dotenv\Loader();
foreach ([
__DIR__ . '/../.env',
__DIR__ . '/../.env.default',
] as $path) {
$dotenvLoader->setFilepath($path)->parse()->skipExisting()->toEnv()->putenv();
} |
Same solution here. We wanted to use DotEnv combined with Docker so sometimes have an .env file and with defaults and sometimes 'overwrite' or pre-set env var's with Docker. This resulted in errors or overwriting the Docker pre-defined env var's.
|
Closing as a workaround exists :) |
https://github.com/josegonzalez/php-dotenv/blob/master/src/josegonzalez/Dotenv/Loader.php#L220
I was under the impression that this package allowed merging of values from all files in the filepaths array. I see now that it doesn't.
Is there any chance this could be altered to merge and replace instead of just replace?
The text was updated successfully, but these errors were encountered: