sloria / environs

simplified environment variable parsing
MIT License
1.19k stars 83 forks source link

Default None breaks dict parser #357

Closed BroFromSpace closed 1 week ago

BroFromSpace commented 1 week ago

I wonder if the dictionary parser is supposed to break when setting default=None?

from environs import Env

env = Env()
env.read_env()

my_env=env.dict('MY_ENV', subcast_keys=str, default=None)
sloria commented 1 week ago

I believe this is symptom of #270, so let's carry on discussion there. for now i think a workaround would be to do

my_env = env.dict('MY_ENV', subcast_keys=str) or None
BroFromSpace commented 1 week ago

Thanks for your response.