问题
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