Describe the bug
It seems that the filter_strategy config (which by the way is misspelled int the docs) is not taken into account when used in the Dynaconf constructor.
To Reproduce
Steps to reproduce the behavior:
-
Having the following folder structure
Just a plain python script.
-
Having the following config files:
No config file, just using env variables
-
Having the following app code:
Code
/test/test.py
import dynaconf
class CustomFilter:
def __call__(self, data):
print("this is never called")
return {
k: v
for k, v in data.items()
if k.startswith("PREFIX")
}
if __name__ == "__main__":
dc = dynaconf.Dynaconf(
envvar_prefix=False,
filter_strategy=CustomFilter(),
)
print(dc.as_dict())
- Executing under the following environment
Execution
PREFIX_VAR="HELLO" OTHER_VAR="WORLD" python test.py
Expected behavior
CustomFilter should be called ("this is never called" should be displayed) and only the PREFIX_VAR should be in dict, not OTHER_VAR
Environment (please complete the following information):
- OS: Linux version 5.10.60.1-microsoft-standard-WSL2
- Dynaconf Version 3.1.9
- Framework: None
Context
I was looking for a way to filter out empty environment variables.
Describe the bug
It seems that the
filter_strategyconfig (which by the way is misspelled int the docs) is not taken into account when used in theDynaconfconstructor.To Reproduce
Steps to reproduce the behavior:
Having the following folder structure
Just a plain python script.
Having the following config files:
No config file, just using env variables
Having the following app code:
Code
/test/test.py
Execution
Expected behavior
CustomFiltershould be called ("this is never called" should be displayed) and only thePREFIX_VARshould be in dict, notOTHER_VAREnvironment (please complete the following information):
Context
I was looking for a way to filter out empty environment variables.