From: Adam Dullage Date: Tue, 18 Jun 2024 19:55:55 +0000 (+0100) Subject: Fix healthcheck when using path prefix X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=224a4019c36fb6df01bc735136e00f7cefc80c80;p=flatnotes.git Fix healthcheck when using path prefix --- diff --git a/healthcheck.sh b/healthcheck.sh index 8d01824..d28d86f 100644 --- a/healthcheck.sh +++ b/healthcheck.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -f http://localhost:${FLATNOTES_PORT}/health || exit 1 +curl -f http://localhost:${FLATNOTES_PORT}${FLATNOTES_PATH_PREFIX}/health || exit 1 diff --git a/server/global_config.py b/server/global_config.py index 4f4f9ee..dd1022a 100644 --- a/server/global_config.py +++ b/server/global_config.py @@ -54,9 +54,12 @@ class GlobalConfig: def _load_path_prefix(self): key = "FLATNOTES_PATH_PREFIX" value = get_env(key, mandatory=False, default="") - value = value.rstrip("/") - if value and not value.startswith("/"): - value = "/" + value + if value and (not value.startswith("/") or value.endswith("/")): + logger.error( + f"Invalid value '{value}' for {key}. " + + "Must start with '/' and not end with '/'." + ) + sys.exit(1) return value