-
Notifications
You must be signed in to change notification settings - Fork 963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List as a environment variable #369
Comments
There's no way to do this because it would introduce a need to escape special chars in env vars that were just strings. For system properties you can set foo.0, foo.1 and it will read as a list. For env vars there isn't a solution we've come up with. |
@havocp what if we define hint for this case, like |
The ".0", ".1" trick does actually work for env vars now IIRC, though many setups make it annoying to set env vars with dots in them. I think there may be something to that idea - It wouldn't have to be list-specific, perhaps a way to simply say "parse this value as JSON" and you could put any kind of JSON in there. |
@havocp now the question is, do we want to make it 'super flexible' so that ppl can inject structure into config from env vars, or we want to limit env injection to only primitives ❓ |
Is this closed as a "won't do this" as it doesn't fit with the design with the library? I think something like this could be useful, but I can understand the reluctance to put in a way to process the environment variable as a list. |
I’m not necessarily against some way to specify values should be parsed as HOCON/JSON, but it can’t be done by default for values that are currently interpreted as plain strings. eg the idea in #582 to have some sort of CONFIG_OVERRIDES variable |
Hi,
I'm trying to override a configuration parameter of a typesafe config with a environment variable but I couldn't make it.
These are the steps that I tried:
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.typesafe.config.ConfigException$ValidationFailed: env var MY_NODES: MY_NODES: Wrong value type at 'MY_NODES', expecting: list but got: string
Is it possible to use list for environment variables? Am I doing something wrong?
Thanks in advance
The text was updated successfully, but these errors were encountered: