Configuration in Elixir with Dotenvy

# config/config.exs
# DON'T DO THIS!!!
import Configconfig :myapp,
password: System.get_env("PASSWORD")

Runtime Config with runtime.exs

# config/runtime.exs
import Config
config :myapp,
password: System.get_env("PASSWORD")

No more Environment Specific Config Files!

Configuration in the Environment

import Config
import Dotenvy
source!(["#{config_env()}.env","#{config_env()}.local.env"])
config :myapp,
password: env!("PASSWORD", :string),
port: env!("PORT", :integer)
# ...
# test.env
PASSWORD=xxxxxxxx
PORT=5432

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store