git.99rst.org
/
flatnotes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
49af119
)
Fix healthcheck when using path prefix
author
Adam Dullage
<redacted>
Tue, 18 Jun 2024 19:55:55 +0000
(20:55 +0100)
committer
Adam Dullage
<redacted>
Tue, 18 Jun 2024 19:55:55 +0000
(20:55 +0100)
healthcheck.sh
patch
|
blob
|
history
server/global_config.py
patch
|
blob
|
history
diff --git
a/healthcheck.sh
b/healthcheck.sh
index 8d01824416f580df512e62bdc5cb0656cee63ad1..d28d86f0be6bacce26c0e17cbd0dc91ab4642411 100644
(file)
--- 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 4f4f9ee0c23bad11c99bd62def5026d6021158e7..dd1022ad7f25ab6ba66303912da06bfd5e130ee9 100644
(file)
--- a/
server/global_config.py
+++ b/
server/global_config.py
@@
-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