Play framework overriding `application.conf` values based on environment

后端 未结 2 1595
孤独总比滥情好
孤独总比滥情好 2021-01-24 15:52

Play 2.6.x Scala

I have a default application.conf within the folder {project}/conf/ but I\'d like to override some values depending on the env

相关标签:
2条回答
  • 2021-01-24 16:36

    This works if you provide the command line argument first

    sbt -Dconfig.resource=qa.conf run
    
    0 讨论(0)
  • 2021-01-24 16:41

    Your question is about HOCON, in case you did not realize it.

    Without seeing your application.conf I can only provide a generic answer. Here is an example of providing a default value for akka.log-config-on-start, which will be overridden by a Java system property or an environment variable called CONFIG_DUMP, if defined:

    akka {
      log-config-on-start = false
      log-config-on-start = ${?CONFIG_DUMP}
    }
    

    This feature of HOCON is documented here.

    0 讨论(0)
提交回复
热议问题