full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

feat(config): add support for separate test database via .env.test

Open EmiFunes91 opened this issue 5 months ago • 1 comments

Summary

This PR adds support for a dedicated PostgreSQL test database by introducing a .env.test file and adapting the config logic to switch automatically based on the ENVIRONMENT variable.

What’s in this PR

  • Adds a .env.test file with ENVIRONMENT=test and POSTGRES_DB=app_test
  • Updates config.py to dynamically load the correct database
  • Documents the workflow under a new Testing Environment section in the README

Why

Right now, both development and test environments point to the same DB (app), which can lead to data conflicts during CI runs or local testing.

This solves Issue #125 by making test isolation simple and configuration-driven—no breaking changes introduced.

Additional Notes

  • The same Docker Compose setup is used for dev and test
  • .env.test is included by default — let me know if you’d prefer it excluded via .gitignore
  • This keeps compatibility with all current workflows while making CI cleaner and safer

EmiFunes91 avatar May 18 '25 04:05 EmiFunes91