dynaconf / dynaconf

Configuration Management for Python ⚙
https://dynaconf.com
MIT License
3.8k stars 293 forks source link

[RFC] Add option to strip the env var prefix from config in settings files #1170

Open taranlu-houzz opened 3 months ago

taranlu-houzz commented 3 months ago

Is your feature request related to a problem? Please describe. I prefer to have the env var names exactly match the names used in the config file and application code.

Describe the solution you'd like

Describe alternatives you've considered This isn't an essential feature, just a nice to have.

Additional context Add any other context or screenshots about the feature request here.

rochacbruno commented 3 months ago

if you set envvar_prefix=False Dynaconf will load all the envvars regardless of prefix, is that what you are looking for?

taranlu-houzz commented 3 months ago

@rochacbruno Not quite. Right now, if I enable envvar_prefix, it will detect PREFIX_MY_VAR=123 in the environment and store it as MY_VAR, but if I set PREFIX_MY_VAR = "123" in the settings file, it will pick that up with that name including the prefix, so I will have dynaconf_obj.MY_VAR and dynacof_obj.PREFIX_MY_VAR.

Basically, I would like to have the flexibility to specify:

rochacbruno commented 3 months ago

Ok, got it now.

We have prefix filtering, but that will just apply the same filtering done to envvars to any source file.

It looks like the feature you are looking for is the ability to set alias #1137

Lets keep this issue open to be considered when implementing the new alias system.