allan2 / dotenvy

A well-maintained fork of the Rust dotenv crate
MIT License
625 stars 39 forks source link

Add from_filename_override variant to dotenvy_macro #72

Open nirvdrum opened 1 year ago

nirvdrum commented 1 year ago

I may be going about this wrong, but I'm working on a Yew application with some configuration values that need to change based on environment (e.g., GraphQL server URLs). While Rust doesn't have the notion of an "environment" in the same way that JavaScript does, using from_filename I can approximate that and keep the config neatly split into multiple files. However, because this is WebAssembly, I need the values to be read in during compilation. dotenv_macro only supports reading in a file named .env via the dotenv! macro. It'd be quite helpful if there were a corresponding from_filename or from_filename_override! macro.