July 2018
Intermediate to advanced
574 pages
14h 7m
English
Let's start by looking at the way we set the database configuration in the elixir_drip umbrella app while developing locally:
$ cat apps/elixir_drip/config/dev.exsuse Mix.Configconfig :elixir_drip, ElixirDrip.Repo, adapter: Ecto.Adapters.Postgres, username: System.get_env("DB_USER"), password: System.get_env("DB_PASS"), database: System.get_env("DB_NAME"), hostname: System.get_env("DB_HOST"), port: System.get_env("DB_PORT"), pool_size: 10
All these Mix configuration entries are evaluated at runtime, so when we run the application with mix or mix phx.server, we know all those entries will be set according to the existing DB_* environment variables. If one of those environment variables doesn't exist, Mix ...