Skip to content

Commit

Permalink
Clearer logs + correct retry value in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
t-anc committed Apr 10, 2024
1 parent 457422c commit 7261bda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ The following env variables can be used to configure the mod (none is compulsory
| `GSP_GTN_ADDR` | `http://localhost:8000` | Gluetun API host address. |
| `GSP_QBT_ADDR` | `http://localhost:8080` | Qbittorrent API host address. If the env variable `WEBUI_PORT` is set, it will be used as default. |
| `GSP_SLEEP` | `60` | Time between checks in seconds. |
| `GSP_RETRY_DELAY` | `9` | Time between retry in case of error (in s). |
| `GSP_RETRY_DELAY` | `10` | Time between retry in case of error (in s). |
| `GSP_QBT_USERNAME` | | NOT IMPLEMENTED YET |
| `GSP_QBT_PASSWORD` | | NOT IMPLEMENTED YET |
| `GSP_SKIP_INIT_CHECKS` | `false` | Set to true to disable qbt config checks ("Bypass authentication on localhost", etc). |
| `GSP_MINIMAL_LOGS` | `true` | Set to false to enable "Ports did not change." logs. |
| `GSP_DEBUG` | `false` | Set to `true` to enable mod's `set -x`. /!\ FOR DEBUG ONLY. |

I was planning to implement the option to use Gluetun's port forwarding file, but since it will be [deprecated in v4](https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/vpn-port-forwarding.md#native-integrations), I won't implement it.
I was planning to implement the option to use Gluetun's port forwarding file but since it will be [deprecated in v4](https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/vpn-port-forwarding.md#native-integrations), I won't.

## Docker compose example
This is just an example for the mod, adapt it to your needs.
Expand Down
9 changes: 5 additions & 4 deletions root/etc/s6-overlay/s6-rc.d/svc-mod-gluetun-sync-port/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Setting variables

MAX_SLEEP_TIME="${GSP_SLEEP:-60}"
RETRY_DELAY="${GSP_RETRY_DELAY:-9}"
RETRY_DELAY="${GSP_RETRY_DELAY:-10}"
[ "${MAX_SLEEP_TIME}" -eq "${RETRY_DELAY}" ] && (( RETRY_DELAY = RETRY_DELAY - 1 )) # To avoid errors later
GLUETUN="${GSP_GTN_ADDR:-http://localhost:8000}"
QBITTORRENT="${GSP_QBT_ADDR:-http://localhost:${WEBUI_PORT:-8080}}"
QBT_USERNAME="${GSP_QBT_USERNAME}"
Expand Down Expand Up @@ -40,12 +41,12 @@ init_checks(){

if { [ -z "${QBT_USERNAME}" ] || [ -z "${QBT_PASSWORD}" ] ;} && [ "$(grep 'LocalHostAuth' ${conf_file} | awk -F'=' '{print $2}')" != "false" ]; then
err='true'
log "${MSG_prefix} The \"Bypass authentication for clients on localhost\" setting is not set"
log "${MSG_prefix} The \"Bypass authentication for clients on localhost\" setting is not set."
fi

if [ "$(curl --write-out '%{http_code}' --silent --output /dev/null "${QBITTORRENT}")" -eq 401 ]; then
err='true'
log "${MSG_prefix} Qbittorrent returned 401. Is the \"Enable Host header validation\" setting set ? Is ${QBITTORRENT} whitelisted ?"
log "${MSG_prefix} Qbittorrent returned 401. Is the \"Enable Host header validation\" setting set ? Is $(basename "${QBITTORRENT%:*}") whitelisted ?"
fi

if [ "${GSP_SKIP_INIT_CHECKS,,}" != 'true' ]; then
Expand All @@ -55,7 +56,7 @@ init_checks(){
sleep 3600
done
else
log "Init checks passed."
log "Init checks passed. Listening for a change."
fi
fi
}
Expand Down

0 comments on commit 7261bda

Please sign in to comment.