Handle overwriting config setting with unescaped falresolverr url in env var (#84)

This commit is contained in:
schroda
2024-01-29 04:55:26 +01:00
committed by GitHub
parent 20faf4f3b6
commit a2dcd0eda8
3 changed files with 38 additions and 43 deletions

View File

@@ -34,7 +34,7 @@ Use the template [docker-compose.yml](./docker-compose.yml) in this repo for cre
There are a number of environment variables available to configure Suwayomi:
| Variable | Server Default | Description |
|:--------------------------------:|:-------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|:--------------------------------:|:-----------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| **TZ** | `Etc/UTC` | What time zone the container thinks it is. |
| **BIND_IP** | `0.0.0.0` | The interface to listen on, inside the container. You almost never want to change this. |
| **BIND_PORT** | `4567` | Which port Suwayomi will listen on |
@@ -65,7 +65,7 @@ There are a number of environment variables available to configure Suwayomi:
| **BACKUP_INTERVAL** | `1` | Time in days - 0 to disable it - range: 1 <= n < ∞ - Interval in which the server will automatically create a backup |
| **BACKUP_TTL** | `14` | Time in days - 0 to disable it - range: 1 <= n < ∞ - How long backup files will be kept before they will get deleted |
| **FLARESOLVERR_ENABLED** | `false` | Whether FlareSolverr is enabled and available to use |
| **FLARESOLVERR_URL** | `http:\/\/localhost:8191` | The URL of the FlareSolverr instance, the URL must be escaped! |
| **FLARESOLVERR_URL** | `http://localhost:8191` | The URL of the FlareSolverr instance |
| **FLARESOLVERR_TIMEOUT** | `60` | Time in seconds for FlareSolverr to timeout if the challenge is not solved |
| **FLARESOLVERR_SESSION_NAME** | `suwayomi` | The name of the session that Suwayomi will use with FlareSolverr |
| **FLARESOLVERR_SESSION_TTL** | `15` | The time to live for the FlareSolverr session |

View File

@@ -15,7 +15,7 @@ services:
- BASIC_AUTH_USERNAME=manga
- BASIC_AUTH_PASSWORD=hello123
- FLARESOLVERR_ENABLED=true
- FLARESOLVERR_URL="http:\/\/flaresolverr:8191"
- FLARESOLVERR_URL="http://flaresolverr:8191"
volumes:
- ./data:/home/suwayomi/.local/share/Tachidesk
ports:

View File

@@ -68,13 +68,8 @@ sed -i -r "s/server.backupTTL = (.*)/server.backupTTL = ${BACKUP_TTL:-\1}/" /hom
# cloudflare bypass
# escape url for sed
if [ -z ${FLARESOLVERR_URL+x} ]; then
FLARESOLVERR_URL=$(echo "${FLARESOLVERR_URL}" | sed 's/[\/&]/\\&/g')
export FLARESOLVERR_URL
fi
sed -i -r "s/server.flareSolverrEnabled = (.*)/server.flareSolverrEnabled = ${FLARESOLVERR_ENABLED:-\1}/" /home/suwayomi/.local/share/Tachidesk/server.conf
sed -i -r "s/server.flareSolverrUrl = \"(.*)\"/server.flareSolverrUrl = \"${FLARESOLVERR_URL:-\1}\"/" /home/suwayomi/.local/share/Tachidesk/server.conf
sed -i -r "s|server.flareSolverrUrl = \"(.*)\"|server.flareSolverrUrl = \"${FLARESOLVERR_URL:-\1}\"|" /home/suwayomi/.local/share/Tachidesk/server.conf
sed -i -r "s/server.flareSolverrTimeout = (.*)/server.flareSolverrTimeout = ${FLARESOLVERR_TIMEOUT:-\1}/" /home/suwayomi/.local/share/Tachidesk/server.conf
sed -i -r "s/server.flareSolverrSessionName = \"(.*)\"/server.flareSolverrSessionName = \"${FLARESOLVERR_SESSION_NAME:-\1}\"/" /home/suwayomi/.local/share/Tachidesk/server.conf
sed -i -r "s/server.flareSolverrSessionTtl = (.*)/server.flareSolverrSessionTtl = ${FLARESOLVERR_SESSION_TTL:-\1}/" /home/suwayomi/.local/share/Tachidesk/server.conf