Skip to content
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

Value is None when set to optional env var and not overridden in included conf with same structure #331

Open
VolodymyrFrolov opened this issue Oct 19, 2024 · 0 comments

Comments

@VolodymyrFrolov
Copy link

VolodymyrFrolov commented Oct 19, 2024

To reproduce the issue several things need to come together:

  1. Value on 2nd+ level of nestiness.
  2. Value should be set via optional env var syntax ${?FOO}.
  3. There should be another config referenced with same structure but w/o overriding that value.
  4. Env var must be unset.

Please see an example for above (url2 added for use-case example only and does not affect reproducibility):

app.conf:

root {
  level1 {
    url1 = "http://default-1"
    url1 = ${?FOO}
    url2 = "http://default-2"
  }
}

include "dev.conf"

dev.conf:

root {
  level1 {
    url2 = "http://dev-2"
  }
}

test.py:

from pyhocon import ConfigFactory
print(ConfigFactory.parse_file('app.conf').get_string('root.level1.url1'))

Expected: http://default-1
Actual: None

Reproduced with v0.3.61, Python 3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant