$ {PORT:-3000}在Heroku Procfile中是什么意思? [英] What does ${PORT:-3000} mean in Heroku Procfile?
问题描述
Heroku建议使用此Procfile命令在Rails 5设置上启动Puma :
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
起初我以为3000是默认值,但实际上,如果开发中缺少PORT
,则工头会使用端口5000.
At first I thought 3000 was a default value, but in fact foreman uses port 5000 if PORT
is missing in development.
问题:符号${VARIABLE:-3000}
是什么意思?
-
更新:看来puma是罪魁祸首: Foreman/Puma没有在dev中使用指定的端口env
Update: It seems like puma is the culprit: Foreman/Puma isn't using the specified port in dev env
推荐答案
这是VARIABLE
的默认值.
使用默认值.如果参数未设置或为null,则展开 单词被替换.否则,参数的值为 替代.
Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
在这种情况下,如果未设置PORT
变量,则其值将为3000
;类似地,如果未设置RACK_ENV
,则其值将为development
.
In this case if the PORT
variable is not set then its value will be 3000
and similarly if RACK_ENV
is not set then it will be development
.
这篇关于$ {PORT:-3000}在Heroku Procfile中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!