Skip to content

[bug] Unable to merge settings with environment variables #709

@gmyrianthous

Description

@gmyrianthous

Describe the bug
I have a dynaconf settings.yaml file with layered environments however, I am unable to overwrite/merge some of the parameters using environment variables.

To Reproduce
Steps to reproduce the behavior:

  1. Having the following config files:
Config files

/path/.env

Your .env content here

and

/path/settings.yaml

default:

	PARAM_1: ''

	docker:
		some_config:
			config_a:
				some_param: 'cde'
				another_param: 'abc'
			config_b:
				different_param: 123
		PARAM_2: ''
		PARAM_3: ''


production:
	PARAM_1: 'param_1_for_prod'

	docker:
		PARAM_2: 'param2_for_prod'
		PARAM_3: 'param3_for_dev'

development:

	PARAM_1: 'param_1_for_dev'

	docker:
		PARAM_2: 'param2_for_dev'
		PARAM_3: 'param3_for_dev'	
  1. Having the following app code:
Code

/path/src/config.py

from dynaconf import settings

settings = Dynaconf(
    envvar_prefix='MY_APP',
    merge_enabled=True,
    environments=True,
    default_env='default',
    env='production',
    env_switcher='MY_APP_ENV',
    ignore_unknown_envvars=True,
    settings_files=['settings.yaml', '.secrets.yaml']
)
  1. Executing under the following environment
Execution
export MY_APP_DOCKER__PARAM_2=my_param

Expected behavior
I would expect that the setting settings.docker.PARAM_2 would be equal to my_param but for some reason this does not work.

The strange thing is that

export MY_APP_PARAM_1=another_param

does work.

The following also works, but for PARAM_3 it does not.

export MY_APP_DOCKER='@merge {PARAM_2=my_param}'

Environment (please complete the following information):

  • OS: OSX Big Sur (11.3)
  • Dynaconf Version: 3.1.5
  • Frameworks in use: -

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions