How to set default list value if system variable is not in type configuration?

Here is the typesafe config documentatioin.

In accordance with this, you can override the following properties:

akka { loglevel = DEBUG loglevel = ${?LOG_LEVEL} } 

So, in this case logLevel will be DEBUG or the value from the LOG_LEVEL system variable.

What about list configuration properties?

 akka { someListProperty = ["oneValue"] someListProperty = [${?LOG_LEVEL}] } 

In this case, if the system variable is missing, someListProperty will be overridden by an empty list.

How to set the default list value if there is no system variable?

+3
source share
2 answers

Old question, but I had a similar problem. You can do it as follows:

 akka { defaultProperty = "oneValue" defaultProperty = ${?SYSTEM_VAR} someListProperty = [${akka.defaultProperty}] } 
+2
source

One possible way would be to have a default configuration and use a backup for this configuration with a set of variables.

For example, this source uses a configuration override on line 58, and then line 92 changes the configuration.

0
source

All Articles