From b8d1f44a2b997d20cf06624e41050d4eaa024127 Mon Sep 17 00:00:00 2001 From: "robin.hruska@teskalabs.com" Date: Mon, 28 Aug 2023 13:38:37 +0200 Subject: [PATCH] Commandline arg should modify config --- asab/application.py | 5 +++++ asab/web/auth/service.py | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/asab/application.py b/asab/application.py index a93e955ed..8105b79d7 100644 --- a/asab/application.py +++ b/asab/application.py @@ -269,6 +269,11 @@ def parse_arguments(self, args=None): Config._default_values['web'] = {} Config._default_values['web']['listen'] = args.web_api + if args.no_auth: + if 'auth' not in Config._default_values: + Config._default_values['auth'] = {} + Config._default_values['auth']['enabled'] = False + if args.startup_housekeeping: Config._default_values['housekeeping']['run_at_startup'] = True diff --git a/asab/web/auth/service.py b/asab/web/auth/service.py index d2f4b0341..832902089 100644 --- a/asab/web/auth/service.py +++ b/asab/web/auth/service.py @@ -110,10 +110,7 @@ def __init__(self, app, service_name="asab.AuthzService"): self.MultitenancyEnabled = asab.Config.getboolean("auth", "multitenancy") self.PublicKeysUrl = asab.Config.get("auth", "public_keys_url") - if self.App.Args.no_auth: - enabled = "no" - else: - enabled = asab.Config.get("auth", "enabled") + enabled = asab.Config.get("auth", "enabled") if enabled == "mock": self.Mode = AuthMode.MOCK elif asab.utils.string_to_boolean(enabled):