auth.Auth.load(): Move type argument into config

Auth.load() takes a "tp" argument, specifying the Auth module name to
load. In case of jw-devops, this is part of the configuration, which
is also passed as an argument. Make taking 'type' from the config the
default. Note that this changes the prototype.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-09-12 08:25:16 +02:00
commit 72d56d9b63

View file

@ -72,7 +72,13 @@ class User: # export
class Auth(abc.ABC): # export
@classmethod
def load(cls, tp: str, conf: Config) -> Self:
def load(cls, conf: Config, tp: str='') -> Self:
if tp == '':
tp = conf.get('type')
if tp is None:
msg = f'No type specified in auth configuration'
conf.dump(ERR, msg)
raise Exception(msg)
return load_object(f'jwutils.auth.{tp}.Auth', Auth, 'Auth', conf)
def __init__(self, conf: Config):