
Some checks failed
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Security Audit (push) Has been cancelled
CI/CD Pipeline / Build Docker Image (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
CI/CD Pipeline / Cleanup (push) Has been cancelled
310 lines
14 KiB
TOML
310 lines
14 KiB
TOML
# Base Configuration - Example Environment
|
|
# Complete example showing all available base configuration options
|
|
|
|
# Root Path Configuration
|
|
# This sets the base directory for all relative paths in the configuration
|
|
root_path = "."
|
|
|
|
# Server Configuration - Example with all options
|
|
[server]
|
|
protocol = "https" # "http" or "https"
|
|
host = "0.0.0.0" # "0.0.0.0" for all interfaces, "127.0.0.1" for localhost only
|
|
port = 443 # 443 for HTTPS, 80 for HTTP, 3030 for development
|
|
environment = "production" # "development", "production", "staging"
|
|
log_level = "info" # "trace", "debug", "info", "warn", "error"
|
|
workers = 4 # Number of worker threads (0 = auto-detect)
|
|
max_connections = 1000 # Maximum concurrent connections
|
|
graceful_shutdown_timeout = 30 # Seconds to wait for graceful shutdown
|
|
keepalive_timeout = 65 # HTTP keep-alive timeout in seconds
|
|
request_timeout = 30 # Request timeout in seconds
|
|
read_timeout = 30 # Read timeout in seconds
|
|
write_timeout = 30 # Write timeout in seconds
|
|
|
|
# Database Configuration - Example with multiple options
|
|
[database]
|
|
# PostgreSQL example
|
|
url = "postgresql://username:password@localhost:5432/database_name"
|
|
# SQLite example
|
|
# url = "sqlite:database.db"
|
|
# MySQL example
|
|
# url = "mysql://username:password@localhost:3306/database_name"
|
|
|
|
max_connections = 20 # Maximum connections in pool
|
|
min_connections = 5 # Minimum connections in pool
|
|
connect_timeout = 10 # Connection timeout in seconds
|
|
idle_timeout = 300 # Idle connection timeout in seconds
|
|
max_lifetime = 1800 # Maximum connection lifetime in seconds
|
|
enable_logging = false # Log database queries
|
|
log_slow_queries = true # Log slow queries only
|
|
slow_query_threshold = 1000 # Slow query threshold in milliseconds
|
|
ssl_mode = "require" # "disable", "allow", "prefer", "require"
|
|
statement_timeout = 30000 # Statement timeout in milliseconds
|
|
migration_timeout = 300 # Migration timeout in seconds
|
|
|
|
# Session Configuration - Example with all options
|
|
[session]
|
|
secret = "your-super-secure-session-secret-key-at-least-32-characters-long"
|
|
cookie_name = "rustelo_session"
|
|
cookie_secure = true # Set to true for HTTPS
|
|
cookie_http_only = true # Prevent JavaScript access
|
|
cookie_same_site = "strict" # "strict", "lax", "none"
|
|
max_age = 3600 # Session duration in seconds
|
|
domain = "example.com" # Cookie domain
|
|
path = "/" # Cookie path
|
|
rolling_timeout = true # Extend session on activity
|
|
cleanup_interval = 3600 # Session cleanup interval in seconds
|
|
|
|
# CORS Configuration - Example with comprehensive settings
|
|
[cors]
|
|
allowed_origins = [
|
|
"https://example.com",
|
|
"https://www.example.com",
|
|
"https://app.example.com"
|
|
]
|
|
allowed_methods = ["GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"]
|
|
allowed_headers = [
|
|
"Content-Type",
|
|
"Authorization",
|
|
"X-Requested-With",
|
|
"X-CSRF-Token",
|
|
"Accept",
|
|
"Origin"
|
|
]
|
|
allow_credentials = true
|
|
max_age = 86400 # Preflight cache duration in seconds
|
|
expose_headers = ["X-Total-Count", "X-Page-Count", "X-Rate-Limit"]
|
|
vary_header = true # Add Vary header for caching
|
|
|
|
# Static Files Configuration - Example with all options
|
|
[static]
|
|
assets_dir = "public" # Static assets directory
|
|
site_root = "target/site" # Site root directory
|
|
site_pkg_dir = "pkg" # Package directory
|
|
enable_compression = true # Enable gzip compression
|
|
enable_caching = true # Enable browser caching
|
|
cache_max_age = 2592000 # Cache max age in seconds (30 days)
|
|
compression_level = 6 # Compression level (1-9)
|
|
compression_types = [ # File types to compress
|
|
"text/html",
|
|
"text/css",
|
|
"text/javascript",
|
|
"application/javascript",
|
|
"application/json",
|
|
"text/xml",
|
|
"application/xml"
|
|
]
|
|
|
|
# Server Directories Configuration - Example with all paths
|
|
[server_dirs]
|
|
public_dir = "/var/www/public" # Public files directory
|
|
uploads_dir = "/var/uploads" # File uploads directory
|
|
logs_dir = "/var/log/rustelo" # Log files directory
|
|
temp_dir = "/tmp/rustelo" # Temporary files directory
|
|
cache_dir = "/var/cache/rustelo" # Cache directory
|
|
config_dir = "/etc/rustelo" # Configuration directory
|
|
data_dir = "/var/lib/rustelo" # Application data directory
|
|
backup_dir = "/var/backups/rustelo" # Backup directory
|
|
templates_dir = "templates" # Template files directory
|
|
locale_dir = "locale" # Localization files directory
|
|
|
|
# Security Configuration - Example with comprehensive security settings
|
|
[security]
|
|
enable_csrf = true # Enable CSRF protection
|
|
csrf_token_name = "csrf_token" # CSRF token form field name
|
|
csrf_cookie_name = "__csrf_token" # CSRF token cookie name
|
|
rate_limit_requests = 100 # Requests per window
|
|
rate_limit_window = 60 # Rate limit window in seconds
|
|
bcrypt_cost = 12 # bcrypt hashing cost
|
|
enable_request_id = true # Add request ID to responses
|
|
request_id_header = "X-Request-ID" # Request ID header name
|
|
enable_security_headers = true # Enable security headers
|
|
content_security_policy = "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'"
|
|
x_frame_options = "DENY" # X-Frame-Options header
|
|
x_content_type_options = "nosniff" # X-Content-Type-Options header
|
|
referrer_policy = "strict-origin-when-cross-origin" # Referrer-Policy header
|
|
|
|
# Application Settings - Example with all options
|
|
[app]
|
|
name = "Rustelo Application" # Application name
|
|
version = "1.0.0" # Application version
|
|
description = "A modern web application built with Rustelo"
|
|
author = "Your Name" # Application author
|
|
website = "https://example.com" # Application website
|
|
support_email = "support@example.com" # Support email
|
|
debug = false # Debug mode
|
|
enable_metrics = true # Enable metrics collection
|
|
enable_health_check = true # Enable health check endpoint
|
|
enable_compression = true # Enable response compression
|
|
max_request_size = 10485760 # Maximum request size in bytes (10MB)
|
|
enable_hot_reload = false # Enable hot reloading
|
|
auto_migrate = false # Auto-run database migrations
|
|
timezone = "UTC" # Application timezone
|
|
locale = "en" # Default locale
|
|
date_format = "%Y-%m-%d" # Date format
|
|
time_format = "%H:%M:%S" # Time format
|
|
datetime_format = "%Y-%m-%d %H:%M:%S" # DateTime format
|
|
|
|
# Logging Configuration - Example with comprehensive logging settings
|
|
[logging]
|
|
format = "json" # "json", "text", "pretty"
|
|
level = "info" # "trace", "debug", "info", "warn", "error"
|
|
file_path = "/var/log/rustelo/app.log" # Log file path
|
|
max_file_size = 104857600 # Maximum log file size in bytes (100MB)
|
|
max_files = 10 # Maximum number of log files to keep
|
|
enable_console = false # Enable console logging
|
|
enable_file = true # Enable file logging
|
|
enable_structured_logging = true # Enable structured logging
|
|
log_request_body = false # Log request bodies
|
|
log_response_body = false # Log response bodies
|
|
enable_audit_log = true # Enable audit logging
|
|
audit_log_path = "/var/log/rustelo/audit.log" # Audit log file path
|
|
enable_access_log = true # Enable access logging
|
|
access_log_path = "/var/log/rustelo/access.log" # Access log file path
|
|
log_rotation = "daily" # "daily", "weekly", "monthly", "size"
|
|
log_compression = true # Compress rotated logs
|
|
|
|
# Redis Configuration - Example with all options
|
|
[redis]
|
|
enabled = true # Enable Redis
|
|
url = "redis://localhost:6379" # Redis connection URL
|
|
pool_size = 20 # Connection pool size
|
|
connection_timeout = 5 # Connection timeout in seconds
|
|
command_timeout = 5 # Command timeout in seconds
|
|
database = 0 # Redis database number
|
|
enable_cluster = false # Enable Redis cluster mode
|
|
cluster_nodes = [] # Redis cluster nodes
|
|
ssl_enabled = false # Enable SSL/TLS
|
|
ssl_cert_path = "" # SSL certificate path
|
|
ssl_key_path = "" # SSL key path
|
|
ssl_ca_path = "" # SSL CA path
|
|
retry_attempts = 3 # Number of retry attempts
|
|
retry_delay = 1000 # Retry delay in milliseconds
|
|
|
|
# Metrics Configuration - Example with comprehensive metrics settings
|
|
[metrics]
|
|
enabled = true # Enable metrics collection
|
|
endpoint = "/metrics" # Metrics endpoint path
|
|
port = 9090 # Metrics server port (0 = use main port)
|
|
host = "127.0.0.1" # Metrics server host
|
|
collect_system_metrics = true # Collect system metrics
|
|
collect_process_metrics = true # Collect process metrics
|
|
collect_http_metrics = true # Collect HTTP metrics
|
|
collect_database_metrics = true # Collect database metrics
|
|
prometheus_enabled = true # Enable Prometheus format
|
|
statsd_enabled = false # Enable StatsD format
|
|
statsd_host = "localhost" # StatsD host
|
|
statsd_port = 8125 # StatsD port
|
|
scrape_interval = 15 # Metrics scrape interval in seconds
|
|
histogram_buckets = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0]
|
|
|
|
# Health Check Configuration - Example with all options
|
|
[health]
|
|
enabled = true # Enable health checks
|
|
endpoint = "/health" # Health check endpoint
|
|
detailed = false # Include detailed health information
|
|
check_database = true # Check database connectivity
|
|
check_redis = true # Check Redis connectivity
|
|
check_external_services = true # Check external service dependencies
|
|
timeout = 5000 # Health check timeout in milliseconds
|
|
interval = 30 # Health check interval in seconds
|
|
failure_threshold = 3 # Number of failures before marking unhealthy
|
|
success_threshold = 1 # Number of successes before marking healthy
|
|
|
|
# Monitoring Configuration - Example with external monitoring
|
|
[monitoring]
|
|
enabled = true # Enable monitoring
|
|
alert_manager_url = "http://localhost:9093" # AlertManager URL
|
|
prometheus_url = "http://localhost:9090" # Prometheus URL
|
|
grafana_url = "http://localhost:3000" # Grafana URL
|
|
enable_traces = true # Enable distributed tracing
|
|
trace_sampling_rate = 0.1 # Trace sampling rate (0.0-1.0)
|
|
jaeger_endpoint = "http://localhost:14268/api/traces" # Jaeger endpoint
|
|
zipkin_endpoint = "http://localhost:9411/api/v2/spans" # Zipkin endpoint
|
|
|
|
# Backup Configuration - Example with automated backups
|
|
[backup]
|
|
enabled = true # Enable automatic backups
|
|
schedule = "0 2 * * *" # Backup schedule (cron format)
|
|
retention_days = 30 # Backup retention in days
|
|
storage_path = "/var/backups/rustelo" # Backup storage path
|
|
compress_backups = true # Compress backup files
|
|
encryption_enabled = true # Enable backup encryption
|
|
encryption_key = "backup-encryption-key" # Backup encryption key
|
|
s3_enabled = false # Enable S3 backup storage
|
|
s3_bucket = "rustelo-backups" # S3 bucket name
|
|
s3_region = "us-east-1" # S3 region
|
|
s3_access_key = "" # S3 access key
|
|
s3_secret_key = "" # S3 secret key
|
|
|
|
# SSL/TLS Configuration - Example with security settings
|
|
[ssl]
|
|
force_https = true # Force HTTPS redirects
|
|
hsts_max_age = 31536000 # HSTS max age in seconds (1 year)
|
|
hsts_include_subdomains = true # Include subdomains in HSTS
|
|
hsts_preload = true # Enable HSTS preload
|
|
upgrade_insecure_requests = true # Upgrade insecure requests
|
|
|
|
# Cache Configuration - Example with caching settings
|
|
[cache]
|
|
enabled = true # Enable caching
|
|
type = "redis" # "memory", "redis", "file"
|
|
default_ttl = 3600 # Default TTL in seconds
|
|
max_memory = 134217728 # Maximum memory usage in bytes (128MB)
|
|
eviction_policy = "lru" # "lru", "lfu", "fifo", "random"
|
|
compression = true # Enable cache compression
|
|
encryption = false # Enable cache encryption
|
|
key_prefix = "rustelo:" # Cache key prefix
|
|
|
|
# Rate Limiting Configuration - Example with comprehensive rate limiting
|
|
[rate_limiting]
|
|
enabled = true # Enable rate limiting
|
|
global_limit = 1000 # Global requests per window
|
|
global_window = 60 # Global window in seconds
|
|
per_ip_limit = 100 # Per-IP requests per window
|
|
per_ip_window = 60 # Per-IP window in seconds
|
|
per_user_limit = 500 # Per-user requests per window
|
|
per_user_window = 60 # Per-user window in seconds
|
|
burst_limit = 10 # Burst limit
|
|
storage = "redis" # "memory", "redis"
|
|
key_prefix = "ratelimit:" # Rate limit key prefix
|
|
|
|
# WebSocket Configuration - Example with WebSocket settings
|
|
[websocket]
|
|
enabled = true # Enable WebSocket support
|
|
path = "/ws" # WebSocket endpoint path
|
|
max_connections = 1000 # Maximum concurrent connections
|
|
ping_interval = 30 # Ping interval in seconds
|
|
pong_timeout = 10 # Pong timeout in seconds
|
|
max_message_size = 1048576 # Maximum message size in bytes (1MB)
|
|
compression = true # Enable WebSocket compression
|
|
origin_check = true # Check WebSocket origin
|
|
allowed_origins = ["https://example.com"] # Allowed origins
|
|
|
|
# Background Jobs Configuration - Example with job processing
|
|
[jobs]
|
|
enabled = true # Enable background jobs
|
|
queue_name = "rustelo_jobs" # Job queue name
|
|
max_workers = 4 # Maximum worker threads
|
|
poll_interval = 5 # Queue polling interval in seconds
|
|
retry_attempts = 3 # Number of retry attempts
|
|
retry_delay = 60 # Retry delay in seconds
|
|
max_job_size = 1048576 # Maximum job size in bytes (1MB)
|
|
job_timeout = 300 # Job timeout in seconds
|
|
dead_letter_queue = true # Enable dead letter queue
|
|
storage = "redis" # "memory", "redis", "database"
|
|
|
|
# API Configuration - Example with API settings
|
|
[api]
|
|
enabled = true # Enable API
|
|
base_path = "/api/v1" # API base path
|
|
rate_limit = 1000 # API rate limit per hour
|
|
enable_cors = true # Enable CORS for API
|
|
enable_authentication = true # Require authentication
|
|
enable_pagination = true # Enable pagination
|
|
default_page_size = 20 # Default page size
|
|
max_page_size = 100 # Maximum page size
|
|
enable_filtering = true # Enable filtering
|
|
enable_sorting = true # Enable sorting
|
|
enable_search = true # Enable search
|
|
api_key_header = "X-API-Key" # API key header name
|