Skip to content

Commit 4026bee

Browse files
committed
fix(api): backups now work with realtime progress and also update.env.example file with upto-date requirements
1 parent c2d4719 commit 4026bee

8 files changed

Lines changed: 504 additions & 58 deletions

File tree

‎apps/api/.env.example‎

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,45 @@
1+
# Dester API - Environment Variables Template
2+
# Copy this file to .env.local and fill in your values
3+
14
# Server Configuration
25
NODE_ENV=development
36
PORT=3000
47

5-
# Database
6-
DATABASE_URL=file:./dev.db
8+
# PostgreSQL Database (from docker-compose.dev.yml)
9+
DATABASE_URL=postgresql://dester:dester_dev@localhost:5432/dester_dev?schema=public
10+
DATABASE_CONNECTION_LIMIT=10
11+
DATABASE_POOL_TIMEOUT=10
712

8-
# Logging
9-
LOG_LEVEL=info
13+
# Authentication (CHANGE THESE IN PRODUCTION!)
14+
JWT_SECRET=change-this-in-production-min-32-chars-long-jwt-secret-key
15+
JWT_EXPIRES_IN=7d
16+
REFRESH_TOKEN_SECRET=change-this-refresh-secret-min-32-chars-long-key
17+
REFRESH_TOKEN_EXPIRES_IN=30d
18+
API_KEY_PREFIX=dester
19+
20+
# Redis Cache (from docker-compose.dev.yml)
21+
CACHE_ENABLED=true
22+
REDIS_URL=redis://:redis_dev@localhost:6379
23+
CACHE_TTL=3600
1024

1125
# CORS
1226
CORS_ORIGIN=http://localhost:5173
27+
WEB_URL=http://localhost:5173
1328

14-
# API Keys
15-
TMDB_API_KEY=
29+
# External APIs
30+
TMDB_API_KEY=your-tmdb-api-key-here
1631

1732
# Rate Limiting
1833
RATE_LIMIT_WINDOW_MS=900000
1934
RATE_LIMIT_MAX_REQUESTS=100
35+
36+
# Logging
37+
LOG_LEVEL=debug
38+
39+
# Backup Configuration
40+
# Set to true to use Docker's pg_dump (recommended when PostgreSQL runs in Docker)
41+
USE_DOCKER_PGDUMP=true
42+
POSTGRES_CONTAINER_NAME=dester-postgres-dev
43+
44+
# Optional: Backup directory (defaults to ./backups)
45+
# BACKUP_DIR=/path/to/backups

‎apps/api/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ COPY --from=builder /app/apps/api/src/generated ./src/generated
4949
COPY apps/api/docker-entrypoint.sh /usr/local/bin/
5050
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
5151

52-
# Install netcat for healthcheck
53-
RUN apk add --no-cache netcat-openbsd
52+
# Install netcat for healthcheck and PostgreSQL client tools for backups
53+
RUN apk add --no-cache netcat-openbsd postgresql-client
5454

5555
# Create logs directory
5656
RUN mkdir -p logs backups

‎apps/api/src/config/env.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
*/
1111

1212
// Load environment variables from .env file
13+
// .env.local takes precedence over .env
1314
import { config } from "dotenv";
14-
config();
15+
config({ path: ".env.local" }); // Load .env.local first (if exists)
16+
config(); // Then load .env (won't override existing vars)
1517

1618
import { z } from "zod";
1719

0 commit comments

Comments
 (0)