[英]How to read array environment variable in application.conf?
I would like to define in application.conf
a variable which will be a list of strings. 我想在application.conf
定义一个变量,它将是一个字符串列表。 Currently in application.conf I have something like this: 当前在application.conf中,我有这样的东西:
some.env.variable = ["a", "b"]
I tried: 我试过了:
some.env.variable = ${?I_AM_ENV}.split(",")
when I_AM_ENV = a,b
but it didn't work. 当I_AM_ENV = a,b
但没有用时。
I get an error when loading app: 加载应用程序时出现错误:
Wrong value type at 'some.env.variable', expecting: list but got: string
According to documentation : 根据文件 :
// in your env
export OPTIONAL_A='"b", "c"'
// in application.conf
path = [ "a", ${?OPTIONAL_A} ]
should evaluate path
to ["a", "b", "c"]
应该评估["a", "b", "c"]
path
Took a while but we found it. 花了一段时间,但我们找到了。
application.conf
access-control-allow-origin = ["http://localhost:4444"]
access-control-allow-origin = ${?CLIENT_DOMAIN}
export CLIENT_DOMAIN.0=http://localhost:3000
export CLIENT_DOMAIN.1=http://localhost:3001
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.