How to know which is my current environment at Phoenix framework
If the MIX_ENV
environment variable is empty Mix.env
defaults to :dev
:
$ iex -S mix
> Mix.env
# => :dev
If you set MIX_ENV
to another existing environment (test or prod, then Mix.env
will return it:
$ MIX_ENV=test iex -S mix
> Mix.env
# => :test
There's no need to define another config.
To get something from your config use for example Application.get_env/2
:
Application.get_env(:your_app_name, YourAppName)[:adapter]
# => Ecto.Adapters.Postgres