api: configure ccujack connection via established config mechanism

This commit is contained in:
lilly 2026-05-15 08:36:49 +02:00
commit f72f830b36
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g
3 changed files with 21 additions and 2 deletions

View file

@ -2,3 +2,4 @@ DOORIS_OPENID_ISSUER=https://id.hamburg.ccc.de/realms/test/
DOORIS_OPENID_CLIENT_ID=dooris DOORIS_OPENID_CLIENT_ID=dooris
DOORIS_OPENID_CLIENT_SECRET=dp9HhnvUhAtKm3pRnxfGA7q8Nwrd1td8 DOORIS_OPENID_CLIENT_SECRET=dp9HhnvUhAtKm3pRnxfGA7q8Nwrd1td8
DOORIS_BASE_URL=http://localhost:8000 DOORIS_BASE_URL=http://localhost:8000
DOORIS_CCUJACK_USER=dooris

View file

@ -46,6 +46,24 @@ def main():
default=os.environ.get("DOORIS_SERVE_STATIC", None), default=os.environ.get("DOORIS_SERVE_STATIC", None),
help="In addition to the API functionality, serve static files from this path", help="In addition to the API functionality, serve static files from this path",
) )
argp.add_argument(
"--ccujack-url",
required=False,
default=os.environ.get("DOORIS_CCUJACK_URL", "https://hmdooris-ccu.ccchh.net:2122"),
help="The URL under which a CCUJACK instance is hosted that actually operates the locks",
)
argp.add_argument(
"--ccujack-user",
required="DOORIS_CCUJACK_USER" not in os.environ,
default=os.environ.get("DOORIS_CCUJACK_USER", None),
help="The username used to authenticate against the CCUJACK",
)
argp.add_argument(
"--ccujack-password",
required="DOORIS_CCUJACK_PASSWORD" not in os.environ,
default=os.environ.get("DOORIS_CCUJACK_PASSWORD", None),
help="The password used to authenticate against the CCUJACK"
)
args = argp.parse_args() args = argp.parse_args()
app_config.set(args) app_config.set(args)

View file

@ -37,8 +37,8 @@ async def lifespan(app: FastAPI):
) )
app.extra["ccujack"] = CCUJackClient( app.extra["ccujack"] = CCUJackClient(
"https://hmdooris-ccu.ccchh.net:2122", base_uri=app_cfg.ccujack_url,
auth=BasicAuth("dooris", os.environ["HMDOORIS_PW"]), auth=BasicAuth(app_cfg.ccujack_user, app_cfg.ccujack_password)
) )
await app.extra["ccujack"].find_locks() await app.extra["ccujack"].find_locks()