Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EmiFunes91
Copy link

Summary

This PR introduces support for using a separate PostgreSQL database during testing by adding a new .env.test file and dynamic configuration logic.

Changes

  • Adds .env.test to define ENVIRONMENT=test and POSTGRES_DB=app_test
  • Updates config.py to automatically switch the database based on environment
  • Documents usage in README.md under a new Testing Environment section

Motivation

Currently, the development and testing environments use the same database (app), which can lead to data collisions or accidental data loss.

This PR addresses Issue #125 by separating configuration and runtime behavior cleanly, without introducing breaking changes.

Notes

  • Docker Compose is reused for both dev and test; no new service is introduced
  • This is backwards compatible and does not interfere with existing setups
  • CI environments can now easily isolate their test database

Let me know if you'd like .env.test to be excluded via .gitignore or if you'd prefer a docker-compose.override.yml for full isolation.

@EmiFunes91
Copy link
Author

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 EmiFunes91 force-pushed the fix/separate-test-dev-db branch from b3f8eb1 to d4469b9 Compare May 18, 2025 05:07
@EmiFunes91 EmiFunes91 force-pushed the fix/separate-test-dev-db branch from d4469b9 to f95084d Compare May 18, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant