From 0daf48ae2b025c1876195dfcc88d5fdece8156b4 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Thu, 24 Apr 2025 08:28:08 +0200 Subject: [PATCH] docker: Make timeout for backend requests configurable. --- docker/README.md | 1 + docker/server/entrypoint.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docker/README.md b/docker/README.md index 07f86b8..06db59f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -28,6 +28,7 @@ The running container can be configured through different environment variables: - `BACKENDS_ALLOWALL`: Allow all backends. Extremly insecure - use only for development! - `BACKENDS_ALLOWALL_SECRET`: Secret when `BACKENDS_ALLOWALL` is enabled. - `BACKENDS`: Space-separated list of backend ids. +- `BACKENDS_TIMEOUT`: Timeout in seconds for requests to backends. - `BACKEND__URL`: Url of backend `ID` (where `ID` is the uppercase backend id). - `BACKEND__SHARED_SECRET`: Shared secret for backend `ID` (where `ID` is the uppercase backend id). - `BACKEND__SESSION_LIMIT`: Optional session limit for backend `ID` (where `ID` is the uppercase backend id). diff --git a/docker/server/entrypoint.sh b/docker/server/entrypoint.sh index 46b3979..dfd073d 100755 --- a/docker/server/entrypoint.sh +++ b/docker/server/entrypoint.sh @@ -248,6 +248,10 @@ if [ ! -f "$CONFIG" ]; then sed -i "s|#secret = the-shared-secret-for-allowall|secret = $BACKENDS_ALLOWALL_SECRET|" "$CONFIG" fi + if [ -n "$BACKENDS_TIMEOUT" ]; then + sed -i "/requests to the backend/,/requests to the backend/ s|^timeout =.*|timeout = $BACKENDS_TIMEOUT|" "$CONFIG" + fi + if [ -n "$BACKENDS" ]; then BACKENDS_CONFIG=${BACKENDS// /,} sed -i "s|#backends = .*|backends = $BACKENDS_CONFIG|" "$CONFIG"