feat: create comprehensive .env.example configuration template

- Add 70+ environment variables organized in logical sections
- Include app metadata, server settings, security, and performance options
- Add feature flags, monitoring, and asset optimization settings
- Provide production-safe defaults with development overrides
- Document all configuration options with clear section headers
- Support file upload limits, CORS configuration, and template settings
This commit is contained in:
William Valentin
2025-09-14 15:57:34 -07:00
parent f3b3562e6a
commit d6851ad58e

275
.env.example Normal file
View File

@@ -0,0 +1,275 @@
# UnitForge Environment Configuration
# Copy this file to .env and modify the values as needed
# =============================================================================
# APPLICATION INFORMATION
# =============================================================================
APP_NAME=UnitForge
APP_VERSION=1.0.0
APP_DESCRIPTION="Create, validate, and manage systemd unit files"
# =============================================================================
# EXTERNAL LINKS
# =============================================================================
GITHUB_URL=https://github.com/will666/unitforge
DOCUMENTATION_URL=https://unitforge.readthedocs.io/
BUG_REPORTS_URL=https://github.com/will666/unitforge/issues
# =============================================================================
# CONTACT INFORMATION
# =============================================================================
CONTACT_EMAIL=contact@unitforge.dev
# =============================================================================
# APPLICATION SETTINGS
# =============================================================================
DEBUG=false
ENVIRONMENT=production
LOG_LEVEL=info
# =============================================================================
# SERVER CONFIGURATION
# =============================================================================
HOST=0.0.0.0
PORT=8000
RELOAD=false
WORKERS=4
# =============================================================================
# API CONFIGURATION
# =============================================================================
API_TITLE="${APP_NAME}"
API_VERSION="${APP_VERSION}"
API_DESCRIPTION=${APP_DESCRIPTION}
DOCS_URL="/api/docs"
REDOC_URL="/api/redoc"
# =============================================================================
# SECURITY SETTINGS
# =============================================================================
# IMPORTANT: Generate a secure secret key for production
SECRET_KEY=your-secret-key-here
ALLOWED_HOSTS=["*"]
# =============================================================================
# CORS CONFIGURATION
# =============================================================================
# Use "*" for all origins or comma-separated list of allowed origins
# Examples:
# CORS_ORIGINS=*
# CORS_ORIGINS=["https://yourdomain.com", "https://www.yourdomain.com"]
CORS_ORIGINS=*
# =============================================================================
# DATABASE (Future Use)
# =============================================================================
# DATABASE_URL="sqlite:///./unitforge.db"
# =============================================================================
# FILE UPLOAD SETTINGS
# =============================================================================
# Maximum file upload size in bytes (1MB)
MAX_UPLOAD_SIZE=1048576
ALLOWED_EXTENSIONS=[".service", ".timer", ".socket", ".mount", ".target", ".path"]
# =============================================================================
# TEMPLATE SETTINGS
# =============================================================================
# Template cache time-to-live in seconds (5 minutes)
TEMPLATE_CACHE_TTL=300
# Validation cache time-to-live in seconds (1 minute)
VALIDATION_CACHE_TTL=60
# =============================================================================
# DEVELOPMENT TOOLS (Override for Development)
# =============================================================================
# Test options (development only)
# PYTEST_ADDOPTS="-v --tb=short --strict-markers"
# COVERAGE_REPORT_DIR="htmlcov"
# MYPY_CONFIG_FILE="pyproject.toml"
# =============================================================================
# UV PACKAGE MANAGER SETTINGS
# =============================================================================
# UV package manager cache directory
# UV_CACHE_DIR=".uv-cache"
# UV_PYTHON="python3"
# =============================================================================
# DOCKER SETTINGS
# =============================================================================
# Docker build settings
# DOCKER_BUILDKIT=1
# COMPOSE_DOCKER_CLI_BUILD=1
# =============================================================================
# PATHS
# =============================================================================
FRONTEND_DIR="frontend"
BACKEND_DIR="backend"
STATIC_DIR="frontend/static"
TEMPLATES_DIR="frontend/templates"
# =============================================================================
# FEATURE FLAGS
# =============================================================================
ENABLE_API_METRICS=false
ENABLE_REQUEST_LOGGING=true
ENABLE_TEMPLATE_CACHING=true
ENABLE_VALIDATION_CACHING=true
# =============================================================================
# PERFORMANCE SETTINGS
# =============================================================================
REQUEST_TIMEOUT=30
KEEPALIVE_TIMEOUT=5
MAX_CONNECTIONS=100
# =============================================================================
# LOGGING CONFIGURATION
# =============================================================================
LOG_FORMAT="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOG_DATE_FORMAT="%Y-%m-%d %H:%M:%S"
ACCESS_LOG=true
# =============================================================================
# DEVELOPMENT SERVER OPTIONS (Development Only)
# =============================================================================
# Development server auto-reload settings
# AUTO_RELOAD=false
# RELOAD_DIRS=["backend", "frontend"]
# RELOAD_DELAY=0.25
# =============================================================================
# TESTING CONFIGURATION
# =============================================================================
# Testing configuration
# TEST_DATABASE_URL="sqlite:///:memory:"
# TEST_PARALLEL=true
# TEST_COVERAGE_THRESHOLD=80
# =============================================================================
# CLI CONFIGURATION
# =============================================================================
CLI_VERBOSE=false
CLI_COLOR=true
CLI_PROGRESS=true
# =============================================================================
# VALIDATION SETTINGS
# =============================================================================
STRICT_VALIDATION=false
SHOW_WARNINGS=true
MAX_VALIDATION_ERRORS=50
# =============================================================================
# TEMPLATE GENERATION DEFAULTS
# =============================================================================
DEFAULT_USER="www-data"
DEFAULT_GROUP="www-data"
DEFAULT_RESTART_POLICY="on-failure"
DEFAULT_WANTED_BY="multi-user.target"
# =============================================================================
# SECURITY HEADERS
# =============================================================================
SECURITY_HEADERS=true
# HSTS max age in seconds (1 year)
HSTS_MAX_AGE=31536000
CSP_ENABLED=true
# =============================================================================
# MONITORING
# =============================================================================
HEALTH_CHECK_ENABLED=true
METRICS_ENABLED=false
TRACING_ENABLED=false
# =============================================================================
# ASSET OPTIMIZATION
# =============================================================================
HOT_RELOAD=false
SOURCE_MAPS=false
MINIFY_ASSETS=true
COMPRESS_RESPONSES=true
# =============================================================================
# DEVELOPMENT TOOLS (Development Only)
# =============================================================================
# Development editor and browser
# EDITOR="code"
# BROWSER="firefox"
# =============================================================================
# GIT HOOKS (Development Only)
# =============================================================================
# Git hooks configuration
# PRE_COMMIT_ENABLED=true
# AUTO_FORMAT=true
# AUTO_LINT=true
# =============================================================================
# DOCUMENTATION
# =============================================================================
DOCS_AUTO_RELOAD=false
API_DOCS_ENABLED=true
SWAGGER_UI_ENABLED=true
REDOC_ENABLED=true
# =============================================================================
# DEVELOPMENT OVERRIDES
# =============================================================================
# Uncomment the following lines for development:
# DEBUG=true
# ENVIRONMENT=development
# LOG_LEVEL=debug
# HOST=127.0.0.1
# RELOAD=true
# WORKERS=1
# API_TITLE="${APP_NAME} Development"
# API_VERSION="${APP_VERSION}-dev"
# SECRET_KEY="dev-secret-key-change-in-production"
# ALLOWED_HOSTS=["localhost", "127.0.0.1", "0.0.0.0", "::1"]
# CORS_ORIGINS=["http://localhost:3000", "http://localhost:8000", "http://127.0.0.1:8000"]
# ENABLE_API_METRICS=true
# AUTO_RELOAD=true
# RELOAD_DIRS=["backend", "frontend"]
# RELOAD_DELAY=0.25
# HOT_RELOAD=true
# SOURCE_MAPS=true
# MINIFY_ASSETS=false
# COMPRESS_RESPONSES=false
# SECURITY_HEADERS=false
# HSTS_MAX_AGE=0
# CSP_ENABLED=false
# DOCS_AUTO_RELOAD=true