how can i override a typesafe config list value on

2019-03-11 14:34发布

i have an application.conf file with a structure like the following:

poller {
  datacenters = []
}

i would like to override datacenters on the command line. for other configuration keys whose values are simple types (strings, numbers) i can override using -Dpath.to.config.value=<value>, and this works fine. however, i can't seem to find a way to do this for lists. in the example above, i tried to set datacenters to ["SJC", "IAD"] like so: -Dpoller.datacenters="['SJC', 'IAD']", but i get an exception that the key value is a string, not a list. is there a way to signal to the typesafe config library that this value is a list?

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-03-11 15:06

I had the same issue some weeks ago, and finally dived into the source code to understand what's going on:

  • This feature is not implemented, it's not possible to define a list using command line argument

Fixing it wouldn't be that hard, but someone need to take time to do it.

查看更多
相关推荐>>
3楼-- · 2019-03-11 15:11

An alternative syntax is implemented in version 1.0.1 for this:

-Dpoller.datacenters.0=SJC -Dpoller.datacenters.1=IAD
查看更多
登录 后发表回答