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

后端 未结 3 1612
生来不讨喜
生来不讨喜 2021-02-05 15:30

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.         


        
3条回答
  •  情话喂你
    2021-02-05 16:28

    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.

提交回复
热议问题