she*_*ger 5 elixir-mix heroku elixir phoenix-framework
我成功地实例化了两个Heroku应用程序:my-app-prod和my-app-test.我在Heroku应用程序设置中配置了特定的环境变量.我在Phoenix使用标准配置文件:config.exs,test.exs,prod.exs,dev.exs.
在Heroku中使用app变量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=prodRun Code Online (Sandbox Code Playgroud)
Elixir 的 Buildpack默认设置MIX_ENV为,因此您实际上不需要在 Procfile 中进行此设置。您可以简单地将其更改为:prod
web: mix phoenix.server
Run Code Online (Sandbox Code Playgroud)
就这样my-app-prod你什么都不用做。就my-app-test设置MIX_ENV为test。您可以使用命令行
heroku config:set MIX_ENV=test --app my-app-test
Run Code Online (Sandbox Code Playgroud)
如果不起作用,请尝试将您的应用程序重新部署到 Heroku。
| 归档时间: |
|
| 查看次数: |
204 次 |
| 最近记录: |