mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
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:
parent
c3685b94da
commit
72d56d9b63
1 changed files with 7 additions and 1 deletions
|
|
@ -72,7 +72,13 @@ class User: # export
|
||||||
class Auth(abc.ABC): # export
|
class Auth(abc.ABC): # export
|
||||||
|
|
||||||
@classmethod
|
@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)
|
return load_object(f'jwutils.auth.{tp}.Auth', Auth, 'Auth', conf)
|
||||||
|
|
||||||
def __init__(self, conf: Config):
|
def __init__(self, conf: Config):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue