How to override an array in configafe config with environment variables?

I use the replacement of environment variables in the Configafe config:

foo = "foo" foo = ${?FOO} 

This results in a "default" value of "foo" if there is no environment variable named FOO . In this case, the declaration of the second value ( foo = ${?FOO} simply discarded). However, if a variable named FOO exists, the library will "substitute" the value of FOO and assign it to FOO .

I would like a similar behavior with arrays, but unfortunately this does not work as expected:

 foo = [ "1", "2" ] foo = [ ${?f1}, ${?f2} ] 

In the case where f1 and f2 not defined, this simply means that FOO is an empty array. My goal is to have a similar effect as described above (discard the second FOO if environment variables f1 and f2 not defined). Any ideas / suggestions are welcome. Thanks.

+5
source share

Source: https://habr.com/ru/post/1262545/


All Articles