bkeepers / dotenv

A Ruby gem to load environment variables from `.env`.
MIT License
6.61k stars 505 forks source link

Question on Removal of ### What other .env* files can I use? FAQ #477

Closed jonmchan closed 10 months ago

jonmchan commented 10 months ago

hi there, love the project... Just wondering if the FAQ for What other .env* files can I use? intentionally removed? I found the table very helpful. I was wondering if your positions on whether to prescribe .gitignore or not has changed or if it was just removed by oversight? Thanks for looking.

https://github.com/bkeepers/dotenv/commit/1350739979a626d242944631fc897358e84d21d0

### What other .env* files can I use?

`dotenv-rails` will override in the following order (highest defined variable overrides lower):

| Hierarchy Priority | Filename                 | Environment          | Should I `.gitignore`it?                            | Notes                                                        |
| ------------------ | ------------------------ | -------------------- | --------------------------------------------------- | ------------------------------------------------------------ |
| 1st (highest)      | `.env.development.local` | Development          | Yes!                                                | Local overrides of environment-specific settings.            |
| 1st                | `.env.test.local`        | Test                 | Yes!                                                | Local overrides of environment-specific settings.            |
| 1st                | `.env.production.local`  | Production           | Yes!                                                | Local overrides of environment-specific settings.            |
| 2nd                | `.env.local`             | Wherever the file is | Definitely.                                         | Local overrides. This file is loaded for all environments _except_ `test`. |
| 3rd                | `.env.development`       | Development          | No.                                                 | Shared environment-specific settings                         |
| 3rd                | `.env.test`              | Test                 | No.                                                 | Shared environment-specific settings                         |
| 3rd                | `.env.production`        | Production           | No.                                                 | Shared environment-specific settings                         |
| Last               | `.env`                   | All Environments     | Depends (See [below](#should-i-commit-my-env-file)) | The Original®                                                |
bkeepers commented 10 months ago

@jonmchan thanks for bringing it up. I tried moviing it around and reformating it, but wasn't loving it and meant to come back to it. I just reintroduced it in https://github.com/bkeepers/dotenv/commit/b0c076f6d7f86796aea6868cd0e2b2049be24872. Let me know what you think.