Play Framework configuration settings Type list variable with environment variable

What I'm trying to do is set the type list configuration variable as an environment variable. I know that I can use env variables as follows:

variable = ${?ENV_VAR}

But what I don't know is how env var should look like a list type. I tried:

( "item1" "item2" )
["item1","item2"]
"item1":"item2"

All three notations cause a configuration exception:

Configuration error [env var ES_NODES: elasticsearch.hosts is of type STRING, not LIST]

How can I describe a game to parse env var as a list?

+4
source share
1 answer

2.3 ( , ...):

env config exmple:

export KAFKA_BROKERS="12.1.1.2:9092,33.3.3.3:9092"

:

kafka.brokersStr = "127.0.0.1:9092","someotherip:9092"
kafka.brokersStr = ${?KAFKA_BROKERS}
kafka.brokers = [${kafka.brokersStr}]

$KAFKA_BROKERS , "kafka.brokersStr" .


, KAFKA_BROKERS , "kafka.brokers" "[]" , $KAFKA_BROKERS .

:
play application.conf , , env var undefined env var, : , env var AA conf :

a.a = "aa" 
a.a = ${?AA}

a.a "aa"

a.a - :

a.a = ["aa"]
a.a = [${?AA}]

a.a "[]"

+1
source

All Articles