This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4d0c2cfbb63 Making `conf.as_dict` extendable by plugging in config
sources (#58268)
4d0c2cfbb63 is described below
commit 4d0c2cfbb6352e491d4944bbd70856f6a071198e
Author: Amogh Desai <[email protected]>
AuthorDate: Fri Nov 14 16:34:16 2025 +0530
Making `conf.as_dict` extendable by plugging in config sources (#58268)
---
airflow-core/src/airflow/configuration.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/airflow-core/src/airflow/configuration.py
b/airflow-core/src/airflow/configuration.py
index d7acb1e6dc8..24ba1d08388 100644
--- a/airflow-core/src/airflow/configuration.py
+++ b/airflow-core/src/airflow/configuration.py
@@ -1559,6 +1559,19 @@ class AirflowConfigParser(ConfigParser):
_section[key] = False
return _section
+ def _get_config_sources_for_as_dict(self) -> list[tuple[str,
ConfigParser]]:
+ """
+ Get list of config sources to use in as_dict().
+
+ Subclasses can override to add additional sources (e.g., provider
configs).
+ """
+ # TODO: When this is moved into shared config parser, override it to
not have provider fallbacks
+ return [
+ ("provider-fallback-defaults",
self._provider_config_fallback_default_values),
+ ("default", self._default_values),
+ ("airflow.cfg", self),
+ ]
+
def as_dict(
self,
display_source: bool = False,
@@ -1609,13 +1622,8 @@ class AirflowConfigParser(ConfigParser):
)
config_sources: ConfigSourcesType = {}
-
# We check sequentially all those sources and the last one we saw it
in will "win"
- configs: Iterable[tuple[str, ConfigParser]] = [
- ("provider-fallback-defaults",
self._provider_config_fallback_default_values),
- ("default", self._default_values),
- ("airflow.cfg", self),
- ]
+ configs = self._get_config_sources_for_as_dict()
self._replace_config_with_display_sources(
config_sources,