How to use config?

I am confused about what is the purpose of config/dev.exs, config/prod.exs and config/config.exs.

It seems dev and prod files are completely ignored and both MIX_ENV=dev and MIX_ENV=prod is loading only config/config.exs.

How should I load dev.exs when MIX_ENV=dev?

MIX_ENV=dev should absolutely load config/dev.exs. Can you share more context like the exact command you are running? Where are you setting MIX_ENV?

1 Like

Ensure that in your config.exs has this:

import Config # to can uses the features of config

# Your general configurations here

import_config "#{config_env()}.exs" # load env based config 

By default MIX_ENV is dev, so this must works out of the box. If you can share your config.exs can help find the issue

3 Likes