mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-05-14 00:28:47 +02:00
Slimmed down the env vars access and added logging in case the password protection was disabled. (#252)
Slimmed down the env vars access and added logging in case the password protection was disabled.
This commit is contained in:
parent
55ebb4c17d
commit
88f0673470
@ -12,8 +12,13 @@ def add_auth(app: Dash) -> None:
|
|||||||
Args:
|
Args:
|
||||||
app: The app a basic auth should be added to.
|
app: The app a basic auth should be added to.
|
||||||
"""
|
"""
|
||||||
if os.getenv("PYTHON_DASH_LOGIN_USERNAME") and os.getenv("PYTHON_DASH_LOGIN_PW"):
|
if (login := os.getenv("PYTHON_DASH_LOGIN_USERNAME", None)) and (
|
||||||
login = os.getenv("PYTHON_DASH_LOGIN_USERNAME")
|
pw := os.getenv("PYTHON_DASH_LOGIN_PW", None)
|
||||||
pw = os.getenv("PYTHON_DASH_LOGIN_PW")
|
):
|
||||||
logger.info("Staring app in password protected mode!")
|
logger.info("Staring app in password protected mode!")
|
||||||
dash_auth.BasicAuth(app, {login: pw})
|
dash_auth.BasicAuth(app, {login: pw})
|
||||||
|
return
|
||||||
|
logger.info("The password protection is not or only partially configured!")
|
||||||
|
logger.debug(
|
||||||
|
"The enviromental variables PYTHON_DASH_LOGIN_USERNAME and PYTHON_DASH_LOGIN_PW should be used to activate this feature."
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user