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 8 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

Hi maintainers!

The check-labels workflow is currently failing because it requires one of the following labels: breaking, security, feature, bug, refactor, upgrade, docs, lang-all, or internal.

Could you please add one of them? I believe feature would be appropriate in this case.

Thank you very much!

EmiFunes91 avatar May 18 '25 04:05 EmiFunes91

@EmiFunes91, have you checked whether it really works (separate db is used)? I haven't run it yet, but it seems that the implementation is incomplete and it will not work

YuriiMotov avatar Sep 03 '25 13:09 YuriiMotov

This pull request has a merge conflict that needs to be resolved.

github-actions[bot] avatar Sep 09 '25 12:09 github-actions[bot]

As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR.

github-actions[bot] avatar Oct 10 '25 17:10 github-actions[bot]