Search code examples
cloudbeesplayframework-2.1

Play 2 & Cloudbees: Could not resolve substitution to a value


I am deploying my Play! 2.1 application on Cloudbees.

I have in my application.conf:

# Database configuration
# ~~~~~ 
db.default.driver=com.mysql.jdbc.Driver
db.default.url=${MYSQL_URL_DB}
db.default.user=${MYSQL_USERNAME_DB}
db.default.password=${MYSQL_PASSWORD_DB}

I defined those values in Cloudbees configuration:

$ bees config:list -a myself/my-app 
Application Parameters:
  proxyBuffering=false
  MYSQL_URL_DB=jdbc:cloudbees://my-app
  MYSQL_USERNAME_DB=my-app
  MYSQL_PASSWORD_DB=yummy
Runtime Parameters:
  java_version=1.7

I publish my app using git (git push cloudbees cloudbees:master) which triggers Jenkins. But when it comes to deploying application, I get in Jenkins logs:

[error] (compile:compile) com.typesafe.config.ConfigException$UnresolvedSubstitution: conf/application.conf: 16: Could not resolve substitution to a value: ${MYSQL_PASSWORD_DB}

Is there anything else to do to make Jenkins aware of the configuration? Did I misunderstand something?

Thanks for your help!

Alban


Solution

  • This configuration is injected at runtime, not build time. You have to find a way to make the sbt build ignore unresolved substitution. It seems a possible workaround is to set MYSQL_URL_DB=foo, etc as build environment variables, so that the check don't break, as they won't be actually injected in your configuration