added postgres support
This commit is contained in:
@@ -81,13 +81,14 @@ uv run uvicorn src.baby_monitor.main:app --reload --host 0.0.0.0 --port 8000
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
| ---------------- | ------------ | ------------------------------------------- |
|
||||
| `ENVIRONMENT` | `production` | Set to `development` to enable API docs |
|
||||
| `ADMIN_PASSWORD` | _(required)_ | Admin user password |
|
||||
| `ADMIN_USERNAME` | `admin` | Admin username |
|
||||
| `DATA_DIR` | `/data` | Directory for SQLite database |
|
||||
| `REDIS_URI` | _(optional)_ | Redis connection URI for distributed tokens |
|
||||
| Variable | Default | Description |
|
||||
| ---------------- | ------------ | --------------------------------------------- |
|
||||
| `ENVIRONMENT` | `production` | Set to `development` to enable API docs |
|
||||
| `ADMIN_PASSWORD` | _(required)_ | Admin user password |
|
||||
| `ADMIN_USERNAME` | `admin` | Admin username |
|
||||
| `DATA_DIR` | `/data` | Directory for SQLite database (SQLite only) |
|
||||
| `REDIS_URI` | _(optional)_ | Redis connection URI for distributed tokens |
|
||||
| `POSTGRES_URI` | _(optional)_ | PostgreSQL connection URI for database storage|
|
||||
|
||||
### Storage Options
|
||||
|
||||
@@ -96,18 +97,26 @@ uv run uvicorn src.baby_monitor.main:app --reload --host 0.0.0.0 --port 8000
|
||||
- Automatic setup, no configuration needed
|
||||
- Data stored in `/data/baby_monitor.db`
|
||||
- Perfect for single-server deployments
|
||||
- Timezone-aware datetimes stored as naive UTC
|
||||
|
||||
**Redis (Optional)**
|
||||
**Redis (Optional - Token Storage)**
|
||||
|
||||
```bash
|
||||
# Enable Redis token storage
|
||||
# Enable Redis token storage for distributed deployments
|
||||
export REDIS_URI=redis://localhost:6379
|
||||
```
|
||||
|
||||
**PostgreSQL (Future)**
|
||||
**PostgreSQL (Optional - Database)**
|
||||
|
||||
- Repository interface ready
|
||||
- Swap implementation in `dependencies.py`
|
||||
```bash
|
||||
# Enable PostgreSQL for production database
|
||||
export POSTGRES_URI=postgresql://user:password@localhost:5432/baby_monitor
|
||||
```
|
||||
|
||||
- Supports timezone-aware datetimes natively
|
||||
- Recommended for production deployments
|
||||
- Better performance for concurrent access
|
||||
- Supports database migrations and backups
|
||||
|
||||
## 📁 Project Structure
|
||||
|
||||
|
||||
Reference in New Issue
Block a user