I'm attempting to configure my elastic beanstalk java application using environment variables via the Procfile like so:
web: ./bin/myservice -Dhttp.port=$PORT
The PORT
environment variable is set via the AWS ui in the "Software Configuration" screen of my beanstalk environment.
However, the logs are indicating that $PORT
is not being interpolated:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.whatever.services.myservice.Main.main(Main.scala)
Caused by: java.lang.NumberFormatException: For input string: "$PORT"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
What is the correct way to pass options to my application?
Edit 1: This seems to be an issue related to the sbt native packager plugin which I use to create a distributable zip archive of the project. The bin/myservice file it generates is interpreting $PORT literally and passing that to the application.