docker: Allow configuring read/write timeouts.

This commit is contained in:
Joachim Bauch 2025-04-24 08:18:36 +02:00
commit 403a4417cb
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
2 changed files with 17 additions and 0 deletions

View file

@ -15,7 +15,11 @@ The running container can be configured through different environment variables:
- `CONFIG`: Optional name of configuration file to use.
- `HTTP_LISTEN`: Address of HTTP listener.
- `HTTP_READ_TIMEOUT`: HTTP socket read timeout in seconds.
- `HTTP_WRITE_TIMEOUT`: HTTP socket write timeout in seconds.
- `HTTPS_LISTEN`: Address of HTTPS listener.
- `HTTPS_READ_TIMEOUT`: HTTPS socket read timeout in seconds.
- `HTTPS_WRITE_TIMEOUT`: HTTPS socket write timeout in seconds.
- `HTTPS_CERTIFICATE`: Name of certificate file for the HTTPS listener.
- `HTTPS_KEY`: Name of private key file for the HTTPS listener.
- `HASH_KEY`: Secret value used to generate checksums of sessions (32 or 64 bytes).

View file

@ -39,8 +39,21 @@ if [ ! -f "$CONFIG" ]; then
if [ -n "$HTTP_LISTEN" ]; then
sed -i "s|#listen = 127.0.0.1:8080|listen = $HTTP_LISTEN|" "$CONFIG"
fi
if [ -n "$HTTP_READ_TIMEOUT" ]; then
sed -i "/HTTP socket/,/HTTP socket/ s|#readtimeout =.*|readtimeout = $HTTP_READ_TIMEOUT|" "$CONFIG"
fi
if [ -n "$HTTP_WRITE_TIMEOUT" ]; then
sed -i "/HTTP socket/,/HTTP socket/ s|#writetimeout =.*|writetimeout = $HTTP_WRITE_TIMEOUT|" "$CONFIG"
fi
if [ -n "$HTTPS_LISTEN" ]; then
sed -i "s|#listen = 127.0.0.1:8443|listen = $HTTPS_LISTEN|" "$CONFIG"
if [ -n "$HTTPS_READ_TIMEOUT" ]; then
sed -i "/HTTPS socket/,/HTTPS socket/ s|#readtimeout =.*|readtimeout = $HTTPS_READ_TIMEOUT|" "$CONFIG"
fi
if [ -n "$HTTPS_WRITE_TIMEOUT" ]; then
sed -i "/HTTPS socket/,/HTTPS socket/ s|#writetimeout =.*|writetimeout = $HTTPS_WRITE_TIMEOUT|" "$CONFIG"
fi
if [ -n "$HTTPS_CERTIFICATE" ]; then
sed -i "s|certificate = /etc/nginx/ssl/server.crt|certificate = $HTTPS_CERTIFICATE|" "$CONFIG"