How do I get test.secret.exs to automatically load in test environment?

It seems as though test.secret.exs does not load up automatically in the test environment.

Application.get_env(:my_app, :my_settings) returns nil even though my test.secret.exs contains the following:

use Mix.Config

config :my_app, :my_settings,
  setting1:      "blah",
  setting2:      "bleh"

I’m running Elixir 1.4.0.

Put

import_config "test.secret.exs"

In your test.exs

1 Like

Should I need to do this when the following is in config.exs?

config/config.exs:

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"

Yes. This expands to test.exs which is how your test.exs is loaded

1 Like

Gotcha! Thanks! :slight_smile:

1 Like