Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am very pro environment vars and consider files an anti pattern. Files are like globals, sibling processes end up sharing state, plus they survive longer than their use case.

Env variables cascade, which is why they have wider uses than program args. You can organize a system as a group of processes and envs are a good way to share state and abstract out the details like prod vs staging without affecting the program implementation.



I'd say it's really about size. A few dozen configs in environmental vars, sure. But once you expand beyond that, need to manage variants of them, need to compose them from fragments you start to see benefits from something more structured like xml, toml, json, or yaml etc.


I just start loading env variables from files, e.g. source blah.env

This way, my bash environment mirrors the task I am working on


I'd say it's really about size.

My wife assures me that size doesn't matter, it's actually the way you use your configs to manage your environmental vars.

(sorry, I just couldn't help myself...)


Envs are also globals. Dynamically scoped globals. They are evil and allow all kind of spooky action at distance, but sometimes they are a necessary evil.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: