feat: Add comprehensive configuration system and examples
Added complete configuration support with multiple formats and examples to help users easily configure py-wikijs for their projects. New Features: - Configuration file templates for ENV, YAML, JSON, and INI formats - config_helper.py: Universal configuration loader and client factory * Auto-detects and loads configs from multiple formats * Supports environment variables, YAML, JSON, and INI files * Provides create_client_from_config() for easy client creation * Validates configuration and provides helpful error messages Configuration Templates: - config.env.example: Environment variables (Docker, 12-factor apps) - config.yaml.example: YAML with multi-environment support - config.json.example: JSON for programmatic configuration - config.ini.example: INI for traditional setups Usage Examples: - using_env_config.py: Complete example using .env files - using_yaml_config.py: Complete example using YAML configuration - using_json_config.py: Complete example using JSON configuration Documentation: - docs/CONFIGURATION_GUIDE.md: Comprehensive configuration guide * All configuration methods explained * Security best practices * Environment-specific configurations * Troubleshooting guide Benefits: ✅ Flexible configuration (choose your preferred format) ✅ Keep credentials secure (no hardcoding) ✅ Environment-specific configs (dev/staging/prod) ✅ Docker/container-ready ✅ Full validation and error handling ✅ Comprehensive documentation and examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
161
examples/config.yaml.example
Normal file
161
examples/config.yaml.example
Normal file
@@ -0,0 +1,161 @@
|
||||
# py-wikijs YAML Configuration File
|
||||
# Copy this file to config.yaml and update with your actual values
|
||||
# Usage: Load with PyYAML package
|
||||
|
||||
# ============================================================
|
||||
# Wiki.js Connection Settings
|
||||
# ============================================================
|
||||
wikijs:
|
||||
# Your Wiki.js instance URL (required)
|
||||
url: "https://wiki.example.com"
|
||||
|
||||
# Authentication settings
|
||||
auth:
|
||||
# Method: api_key, jwt, or none
|
||||
method: "api_key"
|
||||
|
||||
# API key (get from Admin > API Access)
|
||||
api_key: "your-api-key-here"
|
||||
|
||||
# JWT token (alternative to API key)
|
||||
# jwt_token: "your-jwt-token-here"
|
||||
|
||||
# ============================================================
|
||||
# Client Configuration
|
||||
# ============================================================
|
||||
client:
|
||||
# Request timeout in seconds
|
||||
timeout: 30.0
|
||||
|
||||
# Rate limiting (requests per second)
|
||||
# Set to null for no limit
|
||||
rate_limit: 10.0
|
||||
|
||||
# Maximum retry attempts
|
||||
max_retries: 3
|
||||
|
||||
# Verify SSL certificates
|
||||
verify_ssl: true
|
||||
|
||||
# Connection pool size
|
||||
pool_size: 10
|
||||
|
||||
# Custom User-Agent
|
||||
user_agent: "MyApp/1.0 py-wikijs/0.1.0"
|
||||
|
||||
# ============================================================
|
||||
# Logging Configuration
|
||||
# ============================================================
|
||||
logging:
|
||||
# Enable debug logging
|
||||
debug: false
|
||||
|
||||
# Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
level: "INFO"
|
||||
|
||||
# Log format
|
||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
|
||||
# Log to file
|
||||
file:
|
||||
enabled: false
|
||||
path: "/var/log/wikijs-client.log"
|
||||
max_bytes: 10485760 # 10MB
|
||||
backup_count: 5
|
||||
|
||||
# ============================================================
|
||||
# Metrics Configuration
|
||||
# ============================================================
|
||||
metrics:
|
||||
# Enable metrics collection
|
||||
enabled: true
|
||||
|
||||
# Metrics export format
|
||||
format: "prometheus" # prometheus, json, statsd
|
||||
|
||||
# Prometheus settings
|
||||
prometheus:
|
||||
port: 9090
|
||||
path: "/metrics"
|
||||
|
||||
# ============================================================
|
||||
# Cache Configuration (for future versions)
|
||||
# ============================================================
|
||||
cache:
|
||||
# Enable caching
|
||||
enabled: false
|
||||
|
||||
# Cache backend: memory, redis, file
|
||||
backend: "memory"
|
||||
|
||||
# Cache TTL in seconds
|
||||
ttl: 300
|
||||
|
||||
# Maximum cache size (entries)
|
||||
max_size: 1000
|
||||
|
||||
# Redis settings (if backend is redis)
|
||||
redis:
|
||||
url: "redis://localhost:6379/0"
|
||||
password: null
|
||||
ssl: false
|
||||
|
||||
# File cache settings (if backend is file)
|
||||
file:
|
||||
path: "/tmp/wikijs-cache"
|
||||
|
||||
# ============================================================
|
||||
# Feature Flags
|
||||
# ============================================================
|
||||
features:
|
||||
# Enable async support (requires aiohttp)
|
||||
async_enabled: false
|
||||
|
||||
# Enable batch operations
|
||||
batch_enabled: true
|
||||
|
||||
# Enable auto-pagination
|
||||
auto_pagination: true
|
||||
|
||||
# ============================================================
|
||||
# Development Settings
|
||||
# ============================================================
|
||||
development:
|
||||
# Enable development mode
|
||||
enabled: false
|
||||
|
||||
# Mock API responses
|
||||
mock_api: false
|
||||
|
||||
# Save requests/responses for debugging
|
||||
save_debug_data: false
|
||||
debug_data_path: "/tmp/wikijs-debug"
|
||||
|
||||
# ============================================================
|
||||
# Environment-Specific Overrides
|
||||
# ============================================================
|
||||
environments:
|
||||
production:
|
||||
logging:
|
||||
level: "WARNING"
|
||||
client:
|
||||
verify_ssl: true
|
||||
development:
|
||||
enabled: false
|
||||
|
||||
staging:
|
||||
wikijs:
|
||||
url: "https://wiki-staging.example.com"
|
||||
logging:
|
||||
level: "INFO"
|
||||
|
||||
development:
|
||||
wikijs:
|
||||
url: "http://localhost:3000"
|
||||
logging:
|
||||
level: "DEBUG"
|
||||
debug: true
|
||||
client:
|
||||
verify_ssl: false
|
||||
development:
|
||||
enabled: true
|
||||
Reference in New Issue
Block a user