What does ${PORT:-3000} mean in Heroku Procfile?

笑着哭i 提交于 2019-12-25 08:58:45

问题


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}

At first I thought 3000 was a default value, but in fact foreman uses port 5000 if PORT is missing in development.

Question: What does the notation ${VARIABLE:-3000} mean?

--

Update: It seems like puma is the culprit: Foreman/Puma isn't using the specified port in dev env


回答1:


That is the default value of the VARIABLE.

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

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.



来源:https://stackoverflow.com/questions/40932758/what-does-port-3000-mean-in-heroku-procfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!