Skip to content

Setting Nested Value Via Environment Variable Removing All Nested Values #152

Open
@FancyGecko

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

parent_value:
  nested_value1: foo
  nested_value2: bar

code

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'}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions