feat: update default persistence to MongoDB and enhance configuration options
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m19s
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m19s
This commit is contained in:
@@ -38,7 +38,7 @@ npm run dev
|
||||
| `ACCOUNT_DELETION_THRESHOLD_HOURS` | Hours to wait before deleting marked accounts | 720 (30 days) |
|
||||
| `DB_ENV` | Database environment (`prod` or `test`) | `prod` |
|
||||
| `DATA_ENV` | Data directory environment (`prod` or `test`) | `prod` |
|
||||
| `USE_MONGODB` | Use MongoDB instead of TinyDB (`true`/`false`) | `false` |
|
||||
| `USE_MONGODB` | Use MongoDB (`true`/`false`) | `true` |
|
||||
| `MONGO_URI` | MongoDB connection URI (required when `USE_MONGODB=true`) | — |
|
||||
| `MONGO_DB_NAME` | MongoDB database name (optional) | Parsed from `MONGO_URI`, or `chore_db`/`chore_db_test`/`chore_db_e2e` based on `DB_ENV` |
|
||||
|
||||
@@ -46,8 +46,8 @@ npm run dev
|
||||
|
||||
The application supports two persistence backends:
|
||||
|
||||
- **TinyDB** (default): JSON-file storage in `backend/data/db/` (or `backend/test_data/db/` for `test`/`e2e`). No extra configuration needed.
|
||||
- **MongoDB**: Set `USE_MONGODB=true` and provide `MONGO_URI`. Useful for production deployments and managed database hosting (e.g., MongoDB Atlas).
|
||||
- **MongoDB** (default): Set `MONGO_URI` (and optionally `MONGO_DB_NAME`). This is the recommended backend for production and managed hosting (e.g., MongoDB Atlas).
|
||||
- **TinyDB**: JSON-file storage in `backend/data/db/` (or `backend/test_data/db/` for `test`/`e2e`). Opt in by setting `USE_MONGODB=false`.
|
||||
|
||||
#### Migrating from TinyDB to MongoDB
|
||||
|
||||
@@ -62,9 +62,9 @@ python -m scripts.migrate_to_mongodb
|
||||
|
||||
The migration script reads the existing TinyDB JSON files and inserts each record into the matching MongoDB collection, skipping records that already exist. Original TinyDB files are backed up to `backend/data/db/backups/<timestamp>/`.
|
||||
|
||||
#### Rolling Back
|
||||
#### Rolling Back to TinyDB
|
||||
|
||||
To revert to TinyDB, simply set `USE_MONGODB=false` (or unset it). The original JSON files remain in place.
|
||||
Set `USE_MONGODB=false`. The original JSON files remain in place.
|
||||
|
||||
#### Gunicorn / Docker
|
||||
|
||||
|
||||
Reference in New Issue
Block a user