Skip to content

Commit f715d8d

Browse files
Update packages & setup docker-compose to allow override.env file (#239)
## Ticket ## Changes Updated Python packages Add support for an override.env file ## Context for reviewers These python package updates mirror similar ones we've done already on Simpler Grants.gov, so not concerned with any of them. The override.env file uses something added to Docker in January 2024: https://docs.docker.com/reference/compose-file/services/#required - in short, you can specify multiple .env files and have some be optional. This way we can always say to look for override.env, but not require it, and allow a user to write whatever they want to it without checking it in. ## Testing Locally I was able to create override.env, it not be added to git, and the overrides worked (changed `LOG_FORMAT` to `json` and back). --------- Co-authored-by: Kevin Boyer <[email protected]>
1 parent 6775182 commit f715d8d

File tree

5 files changed

+143
-128
lines changed

5 files changed

+143
-128
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ coverage.*
1919
# Environment variables
2020
.env
2121
.envrc
22+
override.env
2223

2324
# mypy
2425
.mypy_cache

app/docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ services:
2424
- RUN_USER=${RUN_USER:-app}
2525
command: ["poetry", "run", "flask", "--app", "src.app", "run", "--host", "0.0.0.0", "--port", "8080", "--reload"]
2626
container_name: main-app
27-
env_file: local.env
27+
env_file:
28+
- path: ./local.env
29+
required: true
30+
- path: ./override.env
31+
required: false
2832
ports:
2933
- 8080:8080
3034
volumes:

app/local.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Local environment variables
22
# Used by docker-compose and it can be loaded
33
# by calling load_local_env_vars() from app/src/util/local.py
4+
#
5+
# To override values for your own personal local development
6+
# create an override.env file in the same directory.
7+
# Any environment variables defined in that file will
8+
# take precedence over those defined here.
9+
#
10+
# See /docs/app/README.md for further details
411

512
ENVIRONMENT=local
613
PORT=8080

0 commit comments

Comments
 (0)