There's a lot of programs out there that can utilize .env files. Most of them support the basic bash-syntax, others support more advanced things like templating within the .env files. The way you're supposed to use .env files varies a lot as well. Often in this context, you'll year from the 12-factor-app which states that you should export (some) configuration as environment variables, that apparently lead to two use cases:
- Some
dotenvprograms do just that: you prefix your command on the shell withdotenvand the variables in the dotenv file will magically be available in you process. - Others however provide libraries that actually read
.envfiles from within your code -- a very different approach since your code is suddenly interpreting.envfiles directly and does not "see" the environment variables anymore.
Since there's so many different interpretations of usage, use-cases and syntax, is there a proper definition of .env files or some commonly accepted standard? If not, at least some historical references?