Title
#beginners-need-help
martinlarsalbert

martinlarsalbert

01/20/2022, 9:47 AM
This was my hack to expose the globals to the jinja2:``` class TemplatedConfigLoaderGlobals(TemplatedConfigLoader): def _load_config_file(self, config_file: Path) -> Dict[str, Any]: """Load an individual config file using
anyconfig
as a backend. Args: config_file: Path to a config file to process. Returns: Parsed configuration. """ # for performance reasons import anyconfig # pylint: disable=import-outside-toplevel if "globals" in str(config_file): globals = {} else: globals_pattern = "*globals.yml" globals = self.get(globals_pattern) if globals_pattern else {} return { k: v for k, v in anyconfig.load( config_file, ac_template=True, ac_context=globals ).items() if not k.startswith("_") } ```