From a3bcd59cc95cd95a5b6ed4a0a3b3f6b6e0d2dd94 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski <janne@kuschku.de> Date: Thu, 9 Jun 2022 00:12:15 +0200 Subject: [PATCH] feat: allow specifying external ip easily --- daemon/Dockerfile | 4 ++++ daemon/entrypoint.sh | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/daemon/Dockerfile b/daemon/Dockerfile index 12de74d..8bd418d 100644 --- a/daemon/Dockerfile +++ b/daemon/Dockerfile @@ -72,6 +72,10 @@ ENV RT_MAX_PEERS_SEED=80 ENV RT_TRACKERS_WANT=80 ENV RT_MEMORY_MAX="1800M" ENV RT_LOGLEVEL="info" +# Set to automatically run this command on startup to set the external address +ENV EXTERNAL_IP_CMD="" +# Set to automatically set the external address +ENV EXTERNAL_IP="" VOLUME ["/data"] VOLUME ["/tmp"] diff --git a/daemon/entrypoint.sh b/daemon/entrypoint.sh index c5576f0..8679a8a 100755 --- a/daemon/entrypoint.sh +++ b/daemon/entrypoint.sh @@ -5,8 +5,13 @@ mkdir -p /tmp/.session echo > /tmp/rtorrent.log rm /tmp/.session/rtorrent.lock /tmp/.session/rtorrent.pid || true -# Start rtorrent as a daemon with the setting in the config file -# & to actually run it in the background -rtorrent -n -o "import=/rtorrent.rc" & +if [ -n "$EXTERNAL_IP_CMD" ]; then + EXTERNAL_IP=$(eval "$EXTERNAL_IP_CMD") +fi +if [ -n "$EXTERNAL_IP" ]; then + rtorrent -i "$EXTERNAL_IP" -n -o "import=/rtorrent.rc" & +else + rtorrent -n -o "import=/rtorrent.rc" & +fi tail -f /tmp/rtorrent.log -- GitLab