Skip to content

Duplicated (non-default) list entries when using environments and merge enabled #653

@hoermannpaul

Description

@hoermannpaul

First and foremost: Thank you for this project

I stumbled over an issue with environments and the merge of lists, namely non-default list items are duplicated in final (environment-specific) list.

Steps to reproduce

python==3.9.6
dynaconf==3.1.5

config file:
/some_folder/test_settings.yaml

default:
  SOME_KEY: "value"
  SOME_LIST:
    - "item_1"
    - "item_2"
    - "item_3"
other:
  SOME_KEY: "new_value"
  SOME_LIST:
    - "item_4"
    - "item_5"

test file:
/some_folder/test.py

from dynaconf import Dynaconf

settings = Dynaconf(settings_files=["test_settings.yaml"], environments=True, merge_enabled=True)

print(f'default env: {settings.from_env("default").SOME_LIST}')
print(f'other env: {settings.from_env("other").SOME_LIST}')

results in:

default env: ['item_1', 'item_2', 'item_3']
other env: ['item_1', 'item_2', 'item_3', 'item_4', 'item_5', 'item_4', 'item_5']

expected:

default env: ['item_1', 'item_2', 'item_3']
other env: ['item_1', 'item_2', 'item_3', 'item_4', 'item_5']

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions