pyserveX/config.yaml

106 lines
2.3 KiB
YAML

http:
static_dir: ./static
templates_dir: ./templates
server:
host: 0.0.0.0
port: 8080
backlog: 5
default_root: false
redirect_instructions:
- "/docs": "/docs.html"
ssl:
enabled: false
cert_file: ./ssl/cert.pem
key_file: ./ssl/key.pem
logging:
level: DEBUG
console_output: true
format:
type: standard
use_colors: true
show_module: true
timestamp_format: "%Y-%m-%d %H:%M:%S"
console:
format:
type: standard
use_colors: true
show_module: true
level: DEBUG
files:
- path: "./logs/pyserve.log"
level: DEBUG
loggers: []
format:
type: standard
use_colors: false
show_module: true
- path: "./logs/pyserve.json"
level: INFO
loggers: []
format:
type: json
use_colors: false
show_module: true
- path: "./logs/server.log"
level: DEBUG
loggers: ["pyserve.server"]
format:
type: standard
use_colors: false
show_module: true
- path: "./logs/access.log"
level: INFO
loggers: ["pyserve.access"]
max_bytes: 5242880 # 5MB
backup_count: 10
format:
type: standard
use_colors: false
show_module: false
# NEW: Extendable modules
extensions:
# Built-in extension for advanced routing
- type: routing
config:
regex_locations:
# API routes with version capture
"~^/api/v(?P<version>\\d+)/":
proxy_pass: "http://localhost:9001"
headers:
- "API-Version: {version}"
- "X-Forwarded-For: $remote_addr"
# Static files with long cache
"~*\\.(js|css|png|jpg|gif|ico|svg|woff2?)$":
root: "./static"
cache_control: "public, max-age=31536000"
headers:
- "Access-Control-Allow-Origin: *"
# Exact match for health check
"=/health":
return: "200 OK"
content_type: "text/plain"
"=/":
root: "./static"
index_file: "index.html"
# SPA fallback for all other routes
"__default__":
spa_fallback: true
root: "./static"
index_file: "docs.html"
# Exceptions for SPA (do not hit fallback)
exclude_patterns:
- "/api/"
- "/admin/"
- "/assets/"