Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to substitute environment variables in playframework's application.conf?

Is there any way to use environment variables in the play! application.conf file? Something like this:

%prod.db.url=${env.DATABASE_JDBC_URL}
%prod.db.driver=org.postgresql.Driver
%prod.jpa.ddl=validate

I don't want to hardcode the URL in my application.conf because it contains credentials that the developer should not have access to.

like image 982
Jesper J. Avatar asked May 20 '11 14:05

Jesper J.


1 Answers

All variables within ${} are resolved using the following sources:

  • ${application.path} equivalent to Play.applicationPath.getAbsolutePath()
  • ${play.path} equivalent to Play.frameworkPath.getAbsolutePath()
  • any other comes from System.getProperty.

So you could add these as -Dkey=name parameters when launching Play! with your secret credentials specific to your environment.

like image 102
Joel Grenon Avatar answered Sep 28 '22 09:09

Joel Grenon