Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions .env.database.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Database Configuration for Claude Task Master
# Copy this file to .env and configure your database settings

# =============================================================================
# DATABASE MODE SELECTION
# =============================================================================
# Choose between 'local' (JSON file) or 'postgres' (PostgreSQL database)
DATABASE_MODE=local

# =============================================================================
# POSTGRESQL CONFIGURATION
# =============================================================================
# Basic connection settings
DB_HOST=localhost
DB_PORT=5432
DB_NAME=codegen_taskmaster_db
DB_USER=software_developer
DB_PASSWORD=password

# SSL Configuration
# Set to 'true' to enable SSL connections
DB_SSL=false

# =============================================================================
# CLOUDFLARE DATABASE PROXY (OPTIONAL)
# =============================================================================
# Enable Cloudflare proxy for secure external database access
CLOUDFLARE_DB_PROXY=false

# Cloudflare proxy URL (when enabled)
# Example: https://your-proxy.your-subdomain.workers.dev
CLOUDFLARE_DB_URL=

# Cloudflare authentication token (when enabled)
CLOUDFLARE_DB_TOKEN=

# =============================================================================
# CONNECTION POOL CONFIGURATION
# =============================================================================
# Minimum number of connections in the pool
DB_POOL_MIN=2

# Maximum number of connections in the pool
DB_POOL_MAX=20

# Time in milliseconds a client must sit idle before being disconnected
DB_IDLE_TIMEOUT=30000

# Time in milliseconds to wait for a connection from the pool
DB_CONNECTION_TIMEOUT=10000

# Time in milliseconds to wait for acquiring a connection
DB_ACQUIRE_TIMEOUT=60000

# Time in milliseconds to wait for creating a new connection
DB_CREATE_TIMEOUT=30000

# Time in milliseconds to wait for destroying a connection
DB_DESTROY_TIMEOUT=5000

# Frequency in milliseconds to check for idle connections to reap
DB_REAP_INTERVAL=1000

# Time in milliseconds to wait between connection creation retry attempts
DB_CREATE_RETRY_INTERVAL=200

# =============================================================================
# LOCAL MODE CONFIGURATION
# =============================================================================
# Path to tasks.json file (when using local mode)
TASKS_FILE=tasks/tasks.json

# Directory for backup files
BACKUP_DIR=tasks/backups

# =============================================================================
# PERFORMANCE AND MONITORING
# =============================================================================
# Enable query performance logging
DB_LOG_QUERIES=false

# Log queries that take longer than this threshold (milliseconds)
DB_SLOW_QUERY_THRESHOLD=100

# Enable connection pool monitoring
DB_MONITOR_POOL=false

# =============================================================================
# SECURITY SETTINGS
# =============================================================================
# Enable row-level security (PostgreSQL only)
DB_ENABLE_RLS=false

# Database user for application connections
DB_APP_USER=app_user

# Database user for admin operations
DB_ADMIN_USER=admin_user

# =============================================================================
# MIGRATION SETTINGS
# =============================================================================
# Automatically run migrations on startup
AUTO_MIGRATE=false

# Create backup before running migrations
MIGRATION_BACKUP=true

# Validate migrations after running
MIGRATION_VALIDATE=true

# =============================================================================
# DEVELOPMENT AND TESTING
# =============================================================================
# Database mode for testing
TEST_DATABASE_MODE=local

# Test database name (PostgreSQL only)
TEST_DB_NAME=codegen_taskmaster_test_db

# Enable debug logging
DEBUG_DATABASE=false

# =============================================================================
# EXAMPLE CONFIGURATIONS
# =============================================================================

# Example 1: Local Development (JSON file mode)
# DATABASE_MODE=local
# TASKS_FILE=tasks/tasks.json
# BACKUP_DIR=tasks/backups

# Example 2: Local PostgreSQL Development
# DATABASE_MODE=postgres
# DB_HOST=localhost
# DB_PORT=5432
# DB_NAME=codegen_taskmaster_dev
# DB_USER=developer
# DB_PASSWORD=dev_password
# DB_SSL=false
# AUTO_MIGRATE=true

# Example 3: Production with Cloudflare Proxy
# DATABASE_MODE=postgres
# CLOUDFLARE_DB_PROXY=true
# CLOUDFLARE_DB_URL=https://db-proxy.your-domain.workers.dev
# CLOUDFLARE_DB_TOKEN=your_secure_token
# DB_POOL_MIN=5
# DB_POOL_MAX=50
# DB_SSL=true
# DB_ENABLE_RLS=true

# Example 4: Staging Environment
# DATABASE_MODE=postgres
# DB_HOST=staging-db.your-domain.com
# DB_PORT=5432
# DB_NAME=codegen_taskmaster_staging
# DB_USER=staging_user
# DB_PASSWORD=staging_password
# DB_SSL=true
# DB_POOL_MIN=3
# DB_POOL_MAX=15
# AUTO_MIGRATE=true
# MIGRATION_BACKUP=true

# =============================================================================
# NOTES
# =============================================================================
# 1. For production environments, always use strong passwords and enable SSL
# 2. Cloudflare proxy is recommended for external database access
# 3. Adjust pool sizes based on your application's concurrency requirements
# 4. Enable RLS (Row-Level Security) for multi-tenant applications
# 5. Regular backups are essential - configure automated backup strategies
# 6. Monitor query performance and adjust indexes as needed
# 7. Use environment-specific configuration files for different deployments

Loading
Loading