Skip to content

Commit

Permalink
Commandline arg should modify config
Browse files Browse the repository at this point in the history
  • Loading branch information
byewokko committed Aug 28, 2023
1 parent dbb1470 commit b8d1f44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 5 additions & 0 deletions asab/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions asab/web/auth/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b8d1f44

Please sign in to comment.