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:
97
examples/config.env.example
Normal file
97
examples/config.env.example
Normal file
@@ -0,0 +1,97 @@
|
||||
# py-wikijs Configuration File
|
||||
# Copy this file to .env and update with your actual values
|
||||
# Usage: Load with python-dotenv package
|
||||
|
||||
# ============================================================
|
||||
# REQUIRED: Wiki.js Connection Settings
|
||||
# ============================================================
|
||||
|
||||
# Your Wiki.js instance URL (no trailing slash)
|
||||
WIKIJS_URL=https://wiki.example.com
|
||||
|
||||
# Your Wiki.js API key (get from Admin > API Access)
|
||||
WIKIJS_API_KEY=your-api-key-here
|
||||
|
||||
# ============================================================
|
||||
# OPTIONAL: Client Configuration
|
||||
# ============================================================
|
||||
|
||||
# Request timeout in seconds (default: 30.0)
|
||||
WIKIJS_TIMEOUT=30.0
|
||||
|
||||
# Rate limit in requests per second (default: None - no limit)
|
||||
# Set to prevent overwhelming your Wiki.js server
|
||||
WIKIJS_RATE_LIMIT=10.0
|
||||
|
||||
# Maximum number of retries for failed requests (default: 3)
|
||||
WIKIJS_MAX_RETRIES=3
|
||||
|
||||
# Enable debug logging (default: false)
|
||||
# Options: true, false
|
||||
WIKIJS_DEBUG=false
|
||||
|
||||
# Log level (default: INFO)
|
||||
# Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
WIKIJS_LOG_LEVEL=INFO
|
||||
|
||||
# ============================================================
|
||||
# OPTIONAL: Authentication Settings
|
||||
# ============================================================
|
||||
|
||||
# Authentication method (default: api_key)
|
||||
# Options: api_key, jwt, none
|
||||
WIKIJS_AUTH_METHOD=api_key
|
||||
|
||||
# JWT Token (if using JWT authentication)
|
||||
# WIKIJS_JWT_TOKEN=your-jwt-token-here
|
||||
|
||||
# ============================================================
|
||||
# OPTIONAL: Advanced Settings
|
||||
# ============================================================
|
||||
|
||||
# Verify SSL certificates (default: true)
|
||||
# Set to false only for development with self-signed certificates
|
||||
WIKIJS_VERIFY_SSL=true
|
||||
|
||||
# Custom User-Agent header
|
||||
# WIKIJS_USER_AGENT=MyApp/1.0 py-wikijs/0.1.0
|
||||
|
||||
# Connection pool size (default: 10)
|
||||
WIKIJS_POOL_SIZE=10
|
||||
|
||||
# Enable metrics collection (default: true)
|
||||
WIKIJS_ENABLE_METRICS=true
|
||||
|
||||
# ============================================================
|
||||
# OPTIONAL: Cache Settings (for future versions)
|
||||
# ============================================================
|
||||
|
||||
# Enable caching (default: false)
|
||||
# WIKIJS_CACHE_ENABLED=false
|
||||
|
||||
# Cache TTL in seconds (default: 300)
|
||||
# WIKIJS_CACHE_TTL=300
|
||||
|
||||
# Cache backend (default: memory)
|
||||
# Options: memory, redis, file
|
||||
# WIKIJS_CACHE_BACKEND=memory
|
||||
|
||||
# Redis URL (if using redis cache backend)
|
||||
# WIKIJS_REDIS_URL=redis://localhost:6379/0
|
||||
|
||||
# ============================================================
|
||||
# NOTES
|
||||
# ============================================================
|
||||
#
|
||||
# 1. Security: NEVER commit .env files to git!
|
||||
# Add .env to your .gitignore file
|
||||
#
|
||||
# 2. Loading: Use python-dotenv to load this file:
|
||||
# pip install python-dotenv
|
||||
# from dotenv import load_dotenv
|
||||
# load_dotenv()
|
||||
#
|
||||
# 3. Override: Environment variables set in shell take precedence
|
||||
#
|
||||
# 4. Validation: Use the config helper to validate settings
|
||||
# See examples/config_helper.py
|
||||
Reference in New Issue
Block a user