added a command line switch for which ldap to use
This commit is contained in:
+8
-1
@@ -3,13 +3,20 @@ import logging
|
||||
from fastapi.responses import RedirectResponse
|
||||
from nicegui import APIRouter, app, ui
|
||||
|
||||
from auth.fakeldap import get_data
|
||||
from state import config
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
if config.fake:
|
||||
log.warning("using fake LDAP")
|
||||
from auth.fakeldap import get_data
|
||||
else:
|
||||
from auth.psildap import get_data
|
||||
|
||||
|
||||
@router.page("/login")
|
||||
def login(redirect_to: str = "/") -> RedirectResponse | None:
|
||||
if app.storage.user.get("authenticated"):
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import argparse
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("-f", "--fake", action="store_true")
|
||||
|
||||
clargs = parser.parse_args()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class Config(dict):
|
||||
__getattr__ = dict.__getitem__
|
||||
__setattr__ = dict.__setitem__
|
||||
__delattr__ = dict.__delitem__
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
from nicegui import app, ui
|
||||
|
||||
from cli import clargs
|
||||
from state import config
|
||||
config.update(vars(clargs))
|
||||
|
||||
from logcfg import logcfg
|
||||
logcfg()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user