From 8e63ffb55bac7990687b8e59d146c7ae8a4672b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guti=C3=A9rrez=20Hermosillo=20Muriedas=2C=20Juan=20Pedro?= Date: Tue, 19 Mar 2024 14:31:46 +0100 Subject: [PATCH] fix: fixed configuration hierarchy --- perun/api/cli.py | 2 -- perun/api/decorator.py | 10 +++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/perun/api/cli.py b/perun/api/cli.py index b3ba534..b51b4c3 100644 --- a/perun/api/cli.py +++ b/perun/api/cli.py @@ -175,8 +175,6 @@ def cli(): if value: save_to_config(key, value) - save_to_config("log_lvl", args.log_lvl) - # set logging log.setLevel(config.get("debug", "log_lvl")) diff --git a/perun/api/decorator.py b/perun/api/decorator.py index ab43054..f714dc2 100644 --- a/perun/api/decorator.py +++ b/perun/api/decorator.py @@ -44,14 +44,18 @@ def perun(configuration_file: str = "./.perun.ini", **conf_kwargs): def inner_function(func): @functools.wraps(func) def func_wrapper(*args, **kwargs): - # Get custom config and kwargs + # 1) Read custom config read_custom_config(configuration_file) + + # 2) Read environment variables + read_environ() + + # 3) Parse remaining arguments for key, value in conf_kwargs.items(): save_to_config(key, value) - read_environ() - perun = Perun(config) app = Application(func, config, args=args, kwargs=kwargs) + perun = Perun(config) func_result = perun.monitor_application(app)