beetbox / beetbox/confuse

Setting Nested Value Via Environment Variable Removing All Nested Values

Open
#152 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
424
Forks
57
PR merge metrics
No merged PRs in 30d

Description

Build: 2.0.0

When I use `set_env()` and only want to change one nested value via environment variables it is removing all the nested values.

config.yaml
```yaml
parent_value:
nested_value1: foo
nested_value2: bar
```

code
```python
import confuse

config = confuse.Configuration('app', __name__)
config.set_file("config.yaml")
config.set_env()

print(config['parent_value'].get())
```

Output: Not setting an environment variable
```
OrderedDict([('nested_value1', 'foo'), ('nested_value2', 'bar')])
```

Output: Setting environment variable `export APP_PARENT_VALUE__NESTED_VALUE1=newValue`
```
{'nested_value1': 'newValue'}
```

Expected Outcome:
```
{'nested_value1': 'newValue', 'nested_value2': 'bar'}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue using config.yaml and the set_env() entry point with APP_PARENT_VALUE__NESTED_VALUE1 set. Trace how nested environment values are applied to the existing configuration and verify that nested_value2 remains unchanged. Done means the output includes both nested_value1 with the new value and nested_value2 with its original value.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.