uranusjr commented on code in PR #54256:
URL: https://github.com/apache/airflow/pull/54256#discussion_r2313230612
##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -682,13 +682,25 @@ def resolve_template_files(self):
def get_template_env(self, *, force_sandboxed: bool = False) ->
jinja2.Environment:
"""Build a Jinja2 environment."""
+ from airflow.configuration import conf
from airflow.sdk.definitions._internal.templater import
NativeEnvironment, SandboxedEnvironment
# Collect directories to search for template files
searchpath = [self.folder]
+
+ # First priority: template_searchpath passed by user
if self.template_searchpath:
searchpath += self.template_searchpath
+ # Always include config path as a fallback source
+ # Developers don't need to configure template_searchpath in every DAG
— they can rely on a global value from airflow.cfg
+ config_path = conf.get("core", "template_searchpath", fallback=None)
+ if config_path:
+ if isinstance(config_path, str):
+ searchpath += [p.strip() for p in config_path.split(",")]
+ elif isinstance(config_path, list):
+ searchpath += config_path
Review Comment:
How can this be a list?
--
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]