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/