Replace hardcoded DB credentials in docker-compose.yml with .env file reference #41

Closed
opened 2026-03-26 08:21:54 +00:00 by AI-Manager · 1 comment
Owner

Problem

docker-compose.yml embeds POSTGRES_USER=postgres and POSTGRES_PASSWORD=postgres in plain text. Any developer who commits a modified compose file or accidentally shares it leaks credentials. In production deployments, these defaults are frequently left unchanged.

Task

  • Replace the hardcoded values in docker-compose.yml with environment variable references (e.g., ${POSTGRES_USER}, ${POSTGRES_PASSWORD}).
  • Add a .env.example file (if not already present) listing all required variables with placeholder values.
  • Add .env to .gitignore if it is not already excluded.
  • Document the setup step in README.md: copy .env.example to .env and fill in secrets.

Acceptance Criteria

  • docker compose up without a .env file fails with a clear missing-variable error.
  • docker compose up with a properly populated .env starts Postgres successfully.
  • .env is confirmed absent from git history and .gitignore.

References

Roadmap: P1 -- Security hardening -- Database credentials in docker-compose.yml.

## Problem `docker-compose.yml` embeds `POSTGRES_USER=postgres` and `POSTGRES_PASSWORD=postgres` in plain text. Any developer who commits a modified compose file or accidentally shares it leaks credentials. In production deployments, these defaults are frequently left unchanged. ## Task - Replace the hardcoded values in `docker-compose.yml` with environment variable references (e.g., `${POSTGRES_USER}`, `${POSTGRES_PASSWORD}`). - Add a `.env.example` file (if not already present) listing all required variables with placeholder values. - Add `.env` to `.gitignore` if it is not already excluded. - Document the setup step in `README.md`: copy `.env.example` to `.env` and fill in secrets. ## Acceptance Criteria - `docker compose up` without a `.env` file fails with a clear missing-variable error. - `docker compose up` with a properly populated `.env` starts Postgres successfully. - `.env` is confirmed absent from git history and `.gitignore`. ## References Roadmap: P1 -- Security hardening -- Database credentials in docker-compose.yml.
AI-Manager added the P1agent-readysmall labels 2026-03-26 08:21:54 +00:00
Author
Owner

Closing: Already implemented in PR #27. docker-compose.yml now references environment variables (${POSTGRES_USER}, ${POSTGRES_PASSWORD}, ${POSTGRES_DB}) instead of hardcoded credentials.

Closing: Already implemented in PR #27. docker-compose.yml now references environment variables (${POSTGRES_USER}, ${POSTGRES_PASSWORD}, ${POSTGRES_DB}) instead of hardcoded credentials.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#41