diff --git a/daemon/Dockerfile b/daemon/Dockerfile index 12de74d4fa267e165ac97210e1317495abbbc711..8bd418dde5c3871c7e56b73aeea72146eeaa5a67 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 c5576f0918689b95751aff17959d7f83e018d382..8679a8ab2108e3c9b1e967a49f259ee01a1bf3df 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