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:
Claude
2025-10-25 19:41:39 +00:00
parent 54de1ea8e1
commit 2ace16f5f0
9 changed files with 1747 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
{
"_comment": "py-wikijs JSON Configuration File",
"_usage": "Copy to config.json and update with your values",
"wikijs": {
"url": "https://wiki.example.com",
"auth": {
"method": "api_key",
"api_key": "your-api-key-here"
}
},
"client": {
"timeout": 30.0,
"rate_limit": 10.0,
"max_retries": 3,
"verify_ssl": true,
"pool_size": 10,
"user_agent": "MyApp/1.0 py-wikijs/0.1.0"
},
"logging": {
"debug": false,
"level": "INFO",
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
"file": {
"enabled": false,
"path": "/var/log/wikijs-client.log",
"max_bytes": 10485760,
"backup_count": 5
}
},
"metrics": {
"enabled": true,
"format": "prometheus"
},
"cache": {
"enabled": false,
"backend": "memory",
"ttl": 300,
"max_size": 1000
},
"features": {
"async_enabled": false,
"batch_enabled": true,
"auto_pagination": true
}
}