为什么工头gem会忽略PORT环境变量? [英] Why is foreman gem ignoring the PORT environment variable?

查看:114
本文介绍了为什么工头gem会忽略PORT环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望工头gem使用我的开发环境文件中提供的PORT值,而不是使用自己的值。我的文件设置如下所示:


  1. 开始工头的bash脚本:

    foreman start -e development.env

  2. development.env文件内容:

    PORT = 3000

  3. Procfile内容

    web:bundle exec rails thin -p $ PORT -e $ RAILS_ENV $ 1


开发服务器最终从端口5000开始。我知道我可以开始工头--p 3000强制它使用该端口。但是这样做打破了env文件的目的。



有什么建议吗?

解决方案

查看代码: https://github.com/ddollar/foreman/ blob / master / lib / foreman / process.rb 看起来工头只会将PORT作为命令行参数。


I want the foreman gem to use the PORT value provided in the my development env file instead of using its own values. My files setup is shown below:

  1. A bash script to start foreman:

    foreman start -e development.env

  2. The development.env file content:

    PORT=3000

  3. The Procfile content

    web: bundle exec rails server thin -p $PORT -e $RAILS_ENV $1

The dev server ends up starting on port 5000. I know I can start foreman with --p 3000 to force it to use that port. But that defeats the purpose of the env file.

Any suggestions?

解决方案

Looking at the code: https://github.com/ddollar/foreman/blob/master/lib/foreman/process.rb it looks foreman will only take the PORT as a command line argument.

这篇关于为什么工头gem会忽略PORT环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆