feat(docs): also update docs for updated db env vars

This commit is contained in:
perf3ct
2025-09-24 19:56:05 +00:00
parent b435437ad3
commit 2a99a32819
3 changed files with 59 additions and 2 deletions

View File

@@ -18,8 +18,17 @@ services:
readur:
build: .
environment:
# Database configuration
# Database configuration - choose one of these methods:
# Method 1: Use DATABASE_URL (takes priority if set)
DATABASE_URL: postgresql://readur:readur@postgres/readur
# Method 2: Use individual PostgreSQL variables
# (Only used if DATABASE_URL is not set or commented out)
# POSTGRES_HOST: postgres
# POSTGRES_PORT: 5432
# POSTGRES_DB: readur
# POSTGRES_USER: readur
# POSTGRES_PASSWORD: readur
# Server configuration - choose one of these methods:
# Method 1: Use SERVER_ADDRESS for full control

View File

@@ -8,7 +8,12 @@ This document provides a comprehensive reference for all configuration options a
| Variable | Type | Default | Description | Required |
|----------|------|---------|-------------|----------|
| `DATABASE_URL` | String | `postgresql://readur:readur@localhost/readur` | PostgreSQL connection string | Yes |
| `DATABASE_URL` | String | `postgresql://readur:readur@localhost/readur` | PostgreSQL connection string (takes priority over individual vars) | Yes* |
| `POSTGRES_HOST` | String | `localhost` | PostgreSQL host (used if DATABASE_URL not set) | No |
| `POSTGRES_PORT` | String | `5432` | PostgreSQL port (used if DATABASE_URL not set) | No |
| `POSTGRES_DB` | String | `readur` | PostgreSQL database name (used if DATABASE_URL not set) | No |
| `POSTGRES_USER` | String | `readur` | PostgreSQL username (used if DATABASE_URL not set) | No |
| `POSTGRES_PASSWORD` | String | `readur` | PostgreSQL password (used if DATABASE_URL not set) | No |
| `SERVER_ADDRESS` | String | `0.0.0.0:8080` | Server bind address (host:port) | No |
| `SERVER_HOST` | String | `0.0.0.0` | Server host (used if SERVER_ADDRESS not set) | No |
| `SERVER_PORT` | String | `8080` | Server port (used if SERVER_ADDRESS not set) | No |
@@ -196,6 +201,29 @@ This document provides a comprehensive reference for all configuration options a
| `FEATURE_WEBDAV` | Boolean | `true` | Enable WebDAV sync | No |
| `FEATURE_API_V2` | Boolean | `false` | Enable API v2 endpoints | No |
## Database Connection Priority
The database connection can be configured in two ways:
1. **Using `DATABASE_URL`** (takes priority if set):
```bash
DATABASE_URL=postgresql://username:password@host:port/database
```
2. **Using individual PostgreSQL variables** (used if `DATABASE_URL` is not set):
```bash
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=readur
POSTGRES_USER=readur
POSTGRES_PASSWORD=your_password
```
This flexibility allows for easy deployment across different platforms:
- **Docker/Kubernetes**: Often provide individual variables
- **Heroku/Railway**: Typically provide `DATABASE_URL`
- **Local Development**: Use either method based on preference
## Configuration Files
### Main Configuration (readur.yml)

View File

@@ -103,6 +103,8 @@ nano .env
```
Required environment variables:
**Option 1: Using DATABASE_URL (recommended)**:
```env
DATABASE_URL=postgresql://readur_user:your_password@localhost/readur
JWT_SECRET=your-super-secret-jwt-key-change-this
@@ -112,6 +114,24 @@ WATCH_FOLDER=./watch
ALLOWED_FILE_TYPES=pdf,png,jpg,jpeg,gif,bmp,tiff,txt,rtf,doc,docx
```
**Option 2: Using individual PostgreSQL variables**:
```env
# DATABASE_URL takes priority if set, but you can use individual variables instead
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=readur
POSTGRES_USER=readur_user
POSTGRES_PASSWORD=your_password
JWT_SECRET=your-super-secret-jwt-key-change-this
SERVER_ADDRESS=0.0.0.0:8000
UPLOAD_PATH=./uploads
WATCH_FOLDER=./watch
ALLOWED_FILE_TYPES=pdf,png,jpg,jpeg,gif,bmp,tiff,txt,rtf,doc,docx
```
> **Note**: If `DATABASE_URL` is set, it takes priority over individual PostgreSQL variables. This is useful for different deployment scenarios where some platforms provide a single connection string while others provide individual components.
3. **Build and Run Backend**:
```bash
# Install dependencies and run