What is the "standard" way to vary config/config.exs per developer?

I am sure this has been asked before, but I don’t know how to search for it.

Elixir is configured by using config/config.exs which people tend to commit in VCS. But what if I need to have things that are different per developer in there (also, maybe things that are the same)? For example some REST API key etc.

In erlang we used to create different releases per developer by using a template for app.config but I’m not sure I really want to go this route again.

Is there a “standard” way of doing this?

2 Likes

Put that stuff in dev.secret.exs or prod.secret.exs (or just config.secret.exs if you are not using different environments) and keep it ignored in your VCS. Then in your config file, at the end use for example:

import_config "dev.secret.exs"
4 Likes

Or you can use environment variables.

5 Likes

+1 to environment variables. We also use that for injecting docker configuration like port numbers that are randomly assigned.

2 Likes