diff --git a/README.md b/README.md index ea3225f2..1222205c 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ docker create \ -e PGID=1000 \ -e TZ=Europe/London \ -e TRANSMISSION_WEB_HOME=/combustion-release/ `#optional` \ + -e USER=username `#optional` \ + -e PASS=password `#optional` \ -p 9091:9091 \ -p 51413:51413 \ -p 51413:51413/udp \ @@ -81,6 +83,8 @@ services: - PGID=1000 - TZ=Europe/London - TRANSMISSION_WEB_HOME=/combustion-release/ #optional + - USER=username #optional + - PASS=password #optional volumes: - :/config - :/downloads @@ -105,6 +109,8 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. | | `-e TRANSMISSION_WEB_HOME=/combustion-release/` | Specify an alternative UI options are `/combustion-release/`, `/transmission-web-control/`, and `/kettu/` . | +| `-e USER=username` | Specify an optional username for the interface | +| `-e PASS=password` | Specify an optional password for the interface | | `-v /config` | Where transmission should store config files and logs. | | `-v /downloads` | Local path for downloads. | | `-v /watch` | Watch folder for torrent files. | @@ -220,6 +226,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **21.08.19:** - Add optional user/pass environment variables, fix transmission shut down if user/pass are set. * **19.07.19:** - Send SIGTERM in blocklist update to properly close pid. * **28.06.19:** - Rebasing to alpine 3.10. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. diff --git a/readme-vars.yml b/readme-vars.yml index 20020a66..660b64d6 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -41,6 +41,8 @@ cap_add_param: false opt_param_usage_include_env: true opt_param_env_vars: - { env_var: "TRANSMISSION_WEB_HOME", env_value: "/combustion-release/", desc: "Specify an alternative UI options are `/combustion-release/`, `/transmission-web-control/`, and `/kettu/` ." } + - { env_var: "USER", env_value: "username", desc: "Specify an optional username for the interface" } + - { env_var: "PASS", env_value: "password", desc: "Specify an optional password for the interface" } opt_param_usage_include_vols: false opt_param_usage_include_ports: false opt_param_device_map: false @@ -81,6 +83,7 @@ app_setup_block: | # changelog changelogs: + - { date: "21.08.19:", desc: "Add optional user/pass environment variables, fix transmission shut down if user/pass are set." } - { date: "19.07.19:", desc: "Send SIGTERM in blocklist update to properly close pid." } - { date: "28.06.19:", desc: "Rebasing to alpine 3.10." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } diff --git a/root/etc/cont-init.d/20-config b/root/etc/cont-init.d/20-config index 1357a575..59e60288 100644 --- a/root/etc/cont-init.d/20-config +++ b/root/etc/cont-init.d/20-config @@ -12,6 +12,14 @@ mkdir -p \ [[ ! -f /config/blocklist-update.sh ]] && cp \ /defaults/blocklist-update.sh /config/blocklist-update.sh +if [ ! -z "$USER" ] && [ ! -z "$PASS" ]; then + sed -i '/rpc-authentication-required/c\ "rpc-authentication-required": true,' /config/settings.json + sed -i "/rpc-username/c\ \"rpc-username\": \"$USER\"," /config/settings.json + sed -i "/rpc-password/c\ \"rpc-password\": \"$PASS\"," /config/settings.json +else + sed -i '/rpc-authentication-required/c\ "rpc-authentication-required": false,' /config/settings.json +fi + # permissions chown abc:abc \ /config/settings.json \ diff --git a/root/etc/services.d/transmission/run b/root/etc/services.d/transmission/run index c35a6e47..a763936c 100644 --- a/root/etc/services.d/transmission/run +++ b/root/etc/services.d/transmission/run @@ -2,7 +2,11 @@ _term() { echo "Caught SIGTERM signal!" - /usr/bin/transmission-remote --exit + if [ ! -z "$USER" ] && [ ! -z "$PASS" ]; then + /usr/bin/transmission-remote -n "$USER":"$PASS" --exit + else + /usr/bin/transmission-remote --exit + fi } trap _term SIGTERM