sloria / environs

simplified environment variable parsing
MIT License
1.22k stars 87 forks source link

Default None breaks dict parser #357

Closed BroFromSpace closed 2 months ago

BroFromSpace commented 2 months 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 2 months 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 2 months ago

Thanks for your response.