gobuffalo / envy

Envy makes working with ENV variables in Go trivial.
MIT License
156 stars 21 forks source link

Add support for .env files #3

Closed dexafree closed 7 years ago

dexafree commented 7 years ago

Fixes #2

dexafree commented 7 years ago

Also, I wonder if it makes sense to try and load .env.XX based on the GO_ENV ENV var. Buffalo uses GO_ENV to switch to production, development, etc... it would be nice if these files were "auto-loaded", if they exist.

That change would be added in the Buffalo project, not here. But first I needed to add support for dotenv files in envy, and then I would be able to add this "autoload" to buffalo.

Note that it wouldn't be useful in things such as:

const PORT = envy.Get("PORT", "8080")

As this kind of values are resolved before any other call has been made (including the envy.Reload one). But this cannot be solved by any means with any library, as it's a language behaviour

markbates commented 7 years ago

thanks!