mistercrunch opened a new pull request, #34210:
URL: https://github.com/apache/superset/pull/34210
## Summary
This PR augments the Flask-based configuration framework for Superset
that modernizes how configuration is handled, documented, and accessed.
The new system provides multi-layered configuration support with
structured metadata and improved developer/operator experience.
## Key Changes
### 🔧 Enhanced Configuration System
- **SupersetConfig class** - Extends Flask's Config with rich metadata
support
- **Environment variable integration** - Uses Flask's
`from_prefixed_env()` with `SUPERSET__` prefix
- **Configuration priority** - Defaults → Environment variables → User
config files
- **Structured metadata** - Replaces comment-based docs with JSON schemas
### 📚 Dynamic Documentation
- **Auto-generated tables** - Configuration reference built from metadata
- **Environment variable examples** - Ready-to-use export statements
- **CLI introspection** - `superset config show/get/env-examples` commands
- **Source tracking** - Shows where each setting comes from
### 🗃️ Database Integration Foundation
- **Settings model** - Database table for runtime configuration
- **Settings DAO** - Following existing Superset patterns
- **Database migration** - Creates settings table structure
### 🔧 Code Quality Improvements
- **Consistent JSON handling** - Uses `superset.utils.json` throughout
- **Proper git history** - Used `git mv` to preserve file history
- **Linter compliance** - Follows Superset coding standards
## Examples
### Environment Variables
```bash
# Basic settings
export SUPERSET__ROW_LIMIT=100000
export SUPERSET__SQLLAB_TIMEOUT=60
# Complex JSON values
export SUPERSET__FEATURE_FLAGS='{"ENABLE_TEMPLATE_PROCESSING": true}'
# Nested configuration
export SUPERSET__THEME_DEFAULT__token__colorPrimary="#1890ff"
CLI Commands
# Show all configuration with sources
superset config show --verbose
# Get environment variable examples
superset config env-examples
# Get specific setting
superset config get ROW_LIMIT
Dynamic Documentation
- Configuration tables auto-generate from metadata
- Environment variable examples with copy-to-clipboard
- Category-based filtering and organization
Test Plan
- Environment variables load correctly with SUPERSET__ prefix
- Configuration precedence works as expected
- CLI commands function properly
- Database migration creates settings table
- Documentation builds with dynamic tables
- Linter passes with proper JSON imports
- Git history preserved for moved files
Future Considerations
- Database-backed settings - Complete runtime configuration without
restarts
- Admin UI - Web interface for configuration management
- Settings validation - Enforce metadata constraints
- API endpoints - REST API for configuration access
- Settings caching - Performance optimization for database settings
- Migration tools - CLI commands for settings import/export
This foundation enables future enhancements while maintaining complete
backward compatibility and following Superset's established patterns.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]