Phoenix: dotenv file

Created on 2 Mar 2019  路  5Comments  路  Source: phoenixframework/phoenix

  • Elixir version (elixir -v): 1.8
  • Phoenix version (mix deps): 1.4
  • NodeJS version (node -v): 11.10.1
  • NPM version (npm -v): I'm using yarn
  • Operating system: Windows 10

It would be nice to have a .env file, instead of setting the variables globally.

Most helpful comment

@Sjoerrdd use system level .env file parser like direnv instead.

All 5 comments

@Sjoerrdd could you elaborate a bit more what you would like to see implemented? I guess you would like to have some wrapper around System.get_env/1 which also looks for .env files so you could use that in your say, dev.exs instead of System.get_env/1, would that be correct?

As for environment variables and setting them for your project, did you already have a look at tools like direnv or autoenv which do some environment variable switching for you?

Personally I currently find myself managing configuration through either explicit values in the dev.exs and test.exs, or through System.get_env/1 in production where I have settings fed through init scripts or docker.

Exactly @rmoorman! 馃檭
Thanks for the quick response,
At the moment I use the standard config files, but my preference is for a .env file as in Adonis & Laravel.

@Sjoerrdd use system level .env file parser like direnv instead.

@Sjoerrdd yet another option to utilize .env files would be a Procfile based tool like foreman or honcho.

The issues tracker is not for feature requests, per the issue template. Thanks!

Was this page helpful?
0 / 5 - 0 ratings