I've instantiated two Heroku apps successfully: my-app-prod and my-app-test. There are specific environment variables I've configured in the Heroku app settings. I am using the standard configuration files in Phoenix: config.exs, test.exs, prod.exs, dev.exs.
After configuring my-app-test in Heroku with the app variable MIX_ENV=test, it is still loading variables from prod.exs.
Are there any additional steps I'm missing so that my app uses test.exs?
I followed all the instructions here: https://hexdocs.pm/phoenix/heroku.html
When I run git push, I can verify it's using prod.exs based on the following output.
remote: Generated my_phoenix_app_name app
remote: -----> Creating .profile.d with env vars
remote: -----> Writing export for multi-buildpack support
remote: -----> Executing post compile: pwd
remote: /tmp/build_f5b9e6e5890fcb58b9689f433c554c6a
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote: Loading config...
remote: Detecting assets directory
remote: * package.json found in custom directory
remote: Will use phoenix configuration:
remote: * assets path .
remote: * mix tasks namespace phoenix
remote: Will use the following versions:
remote: * Node 5.3.0
remote: Will export the following config vars:
remote: CLIENT_ID
remote: DATABASE_URL
remote: POOL_SIZE
remote: SECRET_KEY_BASE
remote: SHOPIFY_SECRET
remote: * MIX_ENV=prod
Buildpack for Elixir is setting
MIX_ENV
toprod
by default, so you don't actually need this setting in your Procfile. You can change it simply to:On
my-app-prod
you don't have to do anything. Onmy-app-test
just setMIX_ENV
totest
. You can use command lineIf it does not work, try to redeploy your apps to Heroku.