ruby-on-rails - ${PORT :-3000} mean in Heroku Procfile? 是什么

标签 ruby-on-rails heroku procfile

Heroku suggests this Procfile command to start Puma on Rails 5 setup :

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

起初我以为 3000 是默认值,但实际上如果开发中缺少 PORT,foreman 会使用端口 5000。

问题${VARIABLE:-3000} 是什么意思?

--

更新: 似乎 puma 是罪魁祸首:Foreman/Puma isn't using the specified port in dev env

最佳答案

这是 VARIABLE 的默认值。

Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.

发件人:https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion

在这种情况下,如果未设置 PORT 变量,则其值为 3000,同样,如果未设置 RACK_ENV,则其值为是开发

关于ruby-on-rails - ${PORT :-3000} mean in Heroku Procfile? 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40932758/

相关文章:

ruby-on-rails - 有没有一种惯用的方法来执行 where(params[ :foo] || '*' ) in Rails?

ruby-on-rails - 我应该如何从我的 puma.rb 中引用我在 Heroku 中的 SSL 证书?

ruby - 工头启动多个进程?

ruby-on-rails - 将 Rails App 推送到 Heroku 时出现此错误是什么?

Heroku 上的 Ruby 守护进程

node.js - dokku 部署上的 Upstart Node.js 应用程序( digital ocean )

c - 读取到 procfile 末尾时遇到问题

ruby-on-rails - 按照给定 ID 数组的顺序按 ID 查找模型记录

ruby-on-rails - 别名方法链未定义的方法

ruby-on-rails - 将瘦网络服务器作为 Windows 服务运行