allan2 / dotenvy

A well-maintained fork of the dotenv crate
MIT License
688 stars 43 forks source link

Overriding files #96

Closed nix6839 closed 1 month ago

nix6839 commented 6 months ago

Coming from bkeepers/dotenv, is there a way to use these files too: bkeepers/dotenv#what-other-env-files-can-i-use?

Hierarchy Priority Filename Environment Should I .gitignoreit? Notes
1st (highest) .env.development.local Development Yes! Local overrides of environment-specific settings.
1st .env.test.local Test Yes! Local overrides of environment-specific settings.
1st .env.production.local Production Yes! Local overrides of environment-specific settings.
2nd .env.local Wherever the file is Definitely. Local overrides. This file is loaded for all environments except test.
3rd .env.development Development No. Shared environment-specific settings
3rd .env.test Test No. Shared environment-specific settings
3rd .env.production Production No. Shared environment-specific settings
Last .env All Environments Depends (See below) The Original®

From: https://github.com/dotenv-rs/dotenv/issues/41

allan2 commented 6 months ago

The specific filenames like .env.development and .env.local are not supported in this crate but you can achieve the same functionality using "from path" functions and override functions. You can see the list of functions on doc.rs.