Fix healthcheck when using path prefix
authorAdam Dullage <redacted>
Tue, 18 Jun 2024 19:55:55 +0000 (20:55 +0100)
committerAdam Dullage <redacted>
Tue, 18 Jun 2024 19:55:55 +0000 (20:55 +0100)
healthcheck.sh
server/global_config.py

index 8d01824416f580df512e62bdc5cb0656cee63ad1..d28d86f0be6bacce26c0e17cbd0dc91ab4642411 100644 (file)
@@ -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
index 4f4f9ee0c23bad11c99bd62def5026d6021158e7..dd1022ad7f25ab6ba66303912da06bfd5e130ee9 100644 (file)
@@ -54,9 +54,12 @@ class GlobalConfig:
     def _load_path_prefix(self):\r
         key = "FLATNOTES_PATH_PREFIX"\r
         value = get_env(key, mandatory=False, default="")\r
-        value = value.rstrip("/")\r
-        if value and not value.startswith("/"):\r
-            value = "/" + value\r
+        if value and (not value.startswith("/") or value.endswith("/")):\r
+            logger.error(\r
+                f"Invalid value '{value}' for {key}. "\r
+                + "Must start with '/' and not end with '/'."\r
+            )\r
+            sys.exit(1)\r
         return value\r
 \r
 \r
git clone https://git.99rst.org/PROJECT