I am trying to deploy my server to Heroku. Heroku has an environmental varriable $PORT that I am supposed to bind to my Swift server.
I tried to achieve this the following way:
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "$PORT"]
For some reason the didn’t work because the port had a ‘\’ character in front of it, like so:
serve --env production --hostname 0.0.0.0 --port \35626
So I tried this to get rid of the first character of the PORT variable:
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "${PORT:1}"]
However on the Heroku servers this translated as
serve --env production --hostname 0.0.0.0 --port \$\{PORT:1\}
I don’t understand why is the ${PORT:1}
is escaped?