Skip to content

Commit

Permalink
modify db docker service to use the env file
Browse files Browse the repository at this point in the history
  • Loading branch information
del9ra committed Nov 14, 2024
1 parent e3441c8 commit 5e12156
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
12 changes: 6 additions & 6 deletions app/.env.docker-example
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ [email protected]
DJANGO_SUPERUSER_PASSWORD=admin

# postgres settings for docker
SQL_ENGINE=django.db.backends.postgresql
SQL_DATABASE=people_depot_dev
SQL_USER=people_depot
SQL_PASSWORD=people_depot
SQL_HOST=db
SQL_PORT=5432
POSTGRES_ENGINE=django.db.backends.postgresql
POSTGRES_DATABASE=people_depot_dev
POSTGRES_USER=people_depot
POSTGRES_PASSWORD=people_depot
POSTGRES_HOST=db
POSTGRES_PORT=5432
DATABASE=postgres

# postgres settings for local development
Expand Down
4 changes: 2 additions & 2 deletions app/peopledepot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@

DATABASES = {
"default": {
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.postgresql"),
"NAME": os.environ.get("SQL_DATABASE", "postgres"),
"USER": os.environ.get("SQL_USER", "user"),
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
"HOST": os.environ.get("SQL_HOST", "localhost"),
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ services:
image: postgres:13.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=people_depot
- POSTGRES_PASSWORD=people_depot
- POSTGRES_DB=people_depot_dev
ports:
- 5432:5432
env_file:
- ./app/.env.docker-example
mkdocs:
image: hackforlaops/mkdocs:latest
command: mkdocs serve --dev-addr 0.0.0.0:8000
Expand Down

0 comments on commit 5e12156

Please sign in to comment.