Open IvanAnishchuk opened 5 years ago
Hey @IvanAnishchuk. Yeah, at least I would be interested.
Meanwhile I found a simple way to do it, looks roughly like this:
if envdir.is_dir(): # envdir is a pathlib.Path
for var in envdir.iterdir():
if var.is_file():
environ.Env.ENVIRON.setdefault(var.name, var.read_text().strip('\n'))
I should probably put it into a simple library so it's reusable easier, it could be used without any modifications on any dict-like or os.environ-like structure, not only with django-environ.
@IvanAnishchuk Could you please send a PR?
One popular alternative for env file format is env directory (python implementation example). It's not necessarily "better" than env files but I think it's popular enough to be useful here. I have a simple implementation for one of my work projects (we use format similar to envdir for docker secrets and configs), should I send a PR here, is anyone interested at all?