elixir - How to know which is my current environment at Phoenix framework -


i following phoenix book says:

be careful. ecto.migrate task migrate database current environment. far, we’ve been running dev environment. change environment, you’d set mix_env operating-system environment variable.

but dont know mi current environment, print echo mix_env variable , it's empty, how can knowwhich environment in and/or change environments?

if mix_env environment variable empty mix.env defaults :dev:

$ iex -s mix > mix.env # => :dev 

if set mix_env existing environment (test or prod, mix.env return it:

$ mix_env=test iex -s mix > mix.env # => :test 

there's no need define config.

to config use example application.get_env/2:

application.get_env(:your_app_name, yourappname)[:adapter] # => ecto.adapters.postgres 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -