|
|
|
|
|
by capableweb
1229 days ago
|
|
Hear hear! The author claims "There is no standard" but I think the standard is so simple it hasn't been written down. The standard is what you said, KEY="value" and that's it. Simple, easy to parse, fast and compatible with how environment variables are declared in `/etc/environment` since forever. Having different .env files for different OSes is easy as well. You have one `.env` that provides the default values, then `.env.linux` for linux, `.env.windows` for windows and so on, and on runtime, first read .env, have values from .env.$os overwrite those, and finally have whatever the actual environment has overwrite those. Again, simple and hard to misunderstand. |
|
Here's a line of bash code that sets the variable X to a single-quote character:
(lest you think that's an unduly obtuse way to do it, this is what `git rev-parse --sq-quote` does! If not 'best practice' it's surely at least 'practice that's gotta be supported'!)Here's what python-dotenv gets:
Similarly, when you use python-dotenv to set a key with the value containing only the single quote the file is not acceptable to bash: