thesimj / envyaml

Simple YAML configuration file parser
MIT License
78 stars 21 forks source link

env.get('empty_env') returns '$NOT_EXIST_ENV_VARIABLE' #27

Closed gabriel-msilva closed 2 years ago

gabriel-msilva commented 3 years ago

From what I understood from the documentation, non-existing environment variables are not working as expected when strict=False.

env.yaml file:

empty_env: $NOT_EXIST_ENV_VARIABLE
from envyaml import EnvYAML

env = EnvYAML('env.yaml', strict=False)
print(env['empty_env'])
# >> $NOT_EXIST_ENV_VARIABLE

I was expecting it to return None.

python=3.7.10
envyaml=1.8.210417
thesimj commented 3 years ago

hi, in this case, it's better to return the original value $NOT_EXIST_ENV_VARIABLE. at least it will show what need to set.