${PORT:-3000} 在 Heroku Procfile 中是什么意思?
What does ${PORT:-3000} mean in 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
,工头使用端口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.
在这种情况下,如果未设置 PORT
变量,则其值将为 3000
,同样,如果未设置 RACK_ENV
,则其值为 development
。
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
,工头使用端口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.
在这种情况下,如果未设置 PORT
变量,则其值将为 3000
,同样,如果未设置 RACK_ENV
,则其值为 development
。