【发布时间】:2018-02-13 05:05:19
【问题描述】:
我已经成功实例化了两个 Heroku 应用:my-app-prod 和 my-app-test。我在 Heroku 应用程序设置中配置了特定的环境变量。我在 Phoenix 中使用标准配置文件:config.exs、test.exs、prod.exs、dev.exs。
在 Heroku 中使用应用变量 MIX_ENV=test 配置 my-app-test 后,它仍在从 prod.exs 加载变量。
我是否缺少任何其他步骤,以便我的应用使用 test.exs?
我按照这里的所有说明进行操作: https://hexdocs.pm/phoenix/heroku.html
当我运行 git push 时,我可以根据以下输出验证它是否正在使用 prod.exs。
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
【问题讨论】:
-
听起来像是在编译时存储变量。您是使用
mix phoenix.server运行应用程序还是使用酿酒厂版本? -
更新帖子,谢谢。
标签: heroku elixir phoenix-framework elixir-mix