This may not address your question (I don't know Scala or JAVA_OPTS
things) but you can use a .profile.d script to dynamically set an environment variable when your app boots. Here's an example where I set a DATABASE_URL
environment variable using the Heroku API:
# .profile.d file
export DATABASE_URL=`curl -s -H "Authorization: Bearer $API_KEY" \
-X GET https://api.heroku.com/apps/$SOURCE_APP/config-vars \
-H "Accept: application/vnd.heroku+json; version=3" \
| grep "DATABASE_URL" | cut -d '"' -f 4 `
This script relies on a valid Heroku API key stored in the applications environment variable API_KEY
, as well as a SOURCE_APP
environment variable, designating the source app (in your case, itself). In this example I'm checking for DATABASE_URL
, but you could use what you want.