msyavuz commented on code in PR #34210: URL: https://github.com/apache/superset/pull/34210#discussion_r2216061361
########## docs/docs/configuration/configuring-superset.mdx: ########## @@ -97,6 +114,102 @@ for more information on how to configure it. At the very least, you'll want to change `SECRET_KEY` and `SQLALCHEMY_DATABASE_URI`. Continue reading for more about each of these. +## Environment Variables Configuration + +For containerized deployments and CI/CD pipelines, Superset supports configuration through environment variables. This is particularly useful for: + +- **Docker deployments** - Configure containers without rebuilding images +- **Kubernetes environments** - Use ConfigMaps and Secrets +- **CI/CD pipelines** - Set configuration dynamically based on environment +- **Development workflows** - Override settings locally without changing files + +### Environment Variable Format + +All Superset environment variables must use the `SUPERSET__` prefix (note the double underscore): + +```bash +# Basic settings +export SUPERSET__ROW_LIMIT=100000 +export SUPERSET__SQLLAB_TIMEOUT=60 Review Comment: I think this was for backwards compatibility with existing config files and not to mess with other env variables, but shouldn't the same configuration options have the same name? ########## docs/docs/configuration/configuring-superset.mdx: ########## @@ -7,13 +7,30 @@ version: 1 # Configuring Superset -## superset_config.py +## Configuration Overview + +Superset provides a flexible, multi-layered configuration system that supports: + +1. **File-based configuration** - Traditional Python configuration files +2. **Environment variables** - For containerized deployments and CI/CD +3. **Database-backed settings** - Runtime configuration changes (coming soon) +4. **Structured metadata** - Rich documentation and validation schemas + +### Configuration Priority + +Configuration values are loaded in the following order (later values override earlier ones): + +1. **Default configuration** - Built-in defaults from `superset/config_defaults.py` +2. **Environment variables** - Values prefixed with `SUPERSET__` +3. **User configuration file** - Your custom `superset_config.py` file Review Comment: I think order of these two should be swapped ########## superset/cli/config.py: ########## @@ -0,0 +1,171 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Configuration introspection CLI commands.""" + +import re +from typing import Any + +import click +import yaml +from flask.cli import with_appcontext + +from superset import app + + +def serialize_config_value(value: Any) -> Any: + """Serialize config values for YAML output, handling callables and objects.""" + if callable(value): + name = value.__name__ if hasattr(value, "__name__") else repr(value) + return f"<callable: {name}>" + elif hasattr(value, "__module__") and hasattr(value, "__name__"): + return f"<object: {value.__module__}.{value.__name__}>" + elif isinstance(value, type): + return f"<class: {value.__module__}.{value.__name__}>" + else: + try: + # Try to serialize with yaml to check if it's serializable + yaml.safe_dump(value) + return value + except yaml.YAMLError: + return repr(value) + + +def get_config_source(key: str) -> str: + """Determine where a config value comes from.""" + import os + + # Check if it's from environment variables (with double underscore prefix) + env_key = f"SUPERSET__{key}" Review Comment: Oh, it also works to differentiate between env and config files -- 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]
