Skip to content

Commit

Permalink
Propagate common configs to individual commands
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline committed Jan 25, 2024
1 parent 5eb3b28 commit 457a04b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dbtmetabase/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ def cli(ctx: click.Context, config_path: str):
if config_path_expanded.exists():
with open(config_path_expanded, "r", encoding="utf-8") as f:
config = yaml.safe_load(f).get("config", {})
# Propagate root configs to all commands
ctx.default_map = {command: config for command in group.commands}
# Propagate common configs to all commands
common = {k: v for k, v in config.items() if k not in group.commands}
ctx.default_map = {
command: {**common, **config.get(command, {})}
for command in group.commands
}


def _add_setup(func: Callable) -> Callable:
Expand Down

0 comments on commit 457a04b

Please sign in to comment.