Phoenix: Setting up ENV Variables
Alexander Lee
255

I like that this doesn’t need any dependencies, but I would like to avoid `source .env` every time.

I used a bit of a hack, where I added config/env.local.exs with:

use Mix.Config
System.put_env("GITHUB_CLIENT_ID", "...")
System.put_env("GITHUB_CLIENT_SECRET", "...")
# config file needs to return config
config :my_app, MyApp.Repo, %{}

And then I require it on top of my config/config.exs

use Mix.Config
import_config "env.local.exs"
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.