Skip to content

Commit 1630cee

Browse files
committed
Improve documentation
1 parent 04b2040 commit 1630cee

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ docker compose --file docker-compose-dev.yaml down --volumes
1818

1919
# Reasonings
2020

21-
## .env files
21+
## Settings and .env files
2222

23-
**Key points:**
23+
Each backend must be deployed to several environments (development, staging, production...), but each company uses different environments (from one to any number), so the backend is the only one that knows the number of environments and their names.
24+
Then, each environment has its own settings (e.g., the logging level or URL of an external service may vary between environments).
2425

25-
- We store settings in .env files.
26-
- There's a .env.{environment} file for each environment (Local, Development, Staging, Production).
27-
- There's a .env file for common settings.
28-
- If a setting is in both .env and .env.{environment}, the one in .env.{environment} takes precedence.
26+
So, we'll use this rules to store settings:
27+
- Store settings in `.env` files.
28+
- A `.env` file for common settings.
29+
- A `.env.{environment}` file for each environment.
30+
- If a setting is in both `.env` and `.env.{environment}`, the one in `.env.{environment}` takes precedence.
2931

30-
The typical is to save .env files in the root of the project, but due to some popular tools and libraries (Jupyter, FastAPI, Docker Compose...) load the file `.env` automatically (and an application has its own order, such as giving priority to the current environment, environment variables or a secret store), then we need to store them in another location (in this case, in the "api" folder) and give `ApplicationSettings` the path to the files.
31-
32-
Note: Renaming `.env` to `.env.Common` in the root isn't better because if your notebook isn't in the root, you have to specify the path in `ApplicationSettings` anyway, and `Common` can be confusing because it's not an environment.
32+
Regarding the location of those files, the typical is to save `.env` files in the root of the project, but due to some popular tools and packages (Jupyter, FastAPI, Docker Compose...) load automatically and exclusively the file `.env`, ignoring the environments and the priority order defined by the backend (e.g., `.env.{environment}` has priority over `.env` because it's the current environment), then we need to store the `.env` files in another location (in this case, in the `api` folder) and give the backend the responsibility of loading them, taking into account the environment name.

0 commit comments

Comments
 (0)