Skip to content

Commit

Permalink
Add environment variable to allow user disable new version checking (w…
Browse files Browse the repository at this point in the history
  • Loading branch information
wahyd4 authored Dec 11, 2021
1 parent 534b94a commit 8d1a326
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ENV RCLONE_CONFIG=/app/conf/rclone.conf
ENV XDG_DATA_HOME=/app/.caddy/data
ENV XDG_CONFIG_HOME=/app/.caddy/config
ENV RCLONE_CONFIG_BASE64=""
ENV ENABLE_APP_CHECKER=true

ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/
ADD conf /app/conf
Expand Down
2 changes: 2 additions & 0 deletions README.CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ services:
* `RPC_SECRET` Aria2 RPC 加密 token
* `DOMAIN` 绑定的域名, 当绑定的域名为`HTTPS`时,即为启用`HTTPS`, 例: `DOMAIN=https://toozhao.com`
* `RCLONE_CONFIG_BASE64` 通过`base64` 字符串的形式配置rclone.conf。主要给在Heroku平台上运行时使用,请使用命令行 `cat /app/conf/rclone.conf | base64` 或者其他任何在线base64在线工具 [比如这个](https://www.base64encode.org/)来把`rclone.conf`的内容生成`base64`字符串。在使用本环境变量的同时,请确保`ENABLE_RCLONE`设置为`true`。
* `ENABLE_APP_CHECKER`,默认情况下本程序会每天向远程服务器发送一次GET请求,以检查是否有新版本的镜像。该功能可以让你及时获取新功能和相关安全隐患的修复的推送提醒。你也可以选择将该环境变量设置为`false`来禁用该功能。注意该功能启用下,依然需要手动更新镜像来完成升级。


### 支持的 Docker volume 属性
* `/data` 用来放置所有下载的文件的目录
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Then simply run `docker-compose up -d`, that's it!
* `RPC_SECRET` The Aria2 RPC secret token
* `DOMAIN` The domain you'd like to bind, when domain is a `https://` thing, then auto TLS feature will be enabled
* `RCLONE_CONFIG_BASE64` Inject and config Rclone through `base64` string, which is the only way to use Rclone on Heroku. Please use `cat /app/conf/rclone.conf | base64` or any base64 online tools such as [this](https://www.base64encode.org/) to encode your `rclone.conf` as bse64 string. Note, you need to set `ENABLE_RCLONE` to true as well.
* `ENABLE_APP_CHECKER`, by default it's set to `true` to check if any new docker image version release on daily basis, which can help you get notification when new features released as well as some security vulnerabilities get fixed. You can set it to `false` to disable this feature. Note: you still need to manually pull the new image version and re run the docker container to complete upgrading.


### Supported Volumes
Expand Down
9 changes: 8 additions & 1 deletion new-version-checker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#! /bin/bash -u
sleep 5

if [ "$ENABLE_APP_CHECKER" = "false" ]; then
echo "[INFO] Skip checking new version"
# Do nothing and just sleep 10 years
sleep 315360000
exit 0
fi

set -e
APP_VERSION=$(cat APP_VERSION)
set +e
Expand All @@ -19,6 +26,6 @@ while true; do
sleep 86400
continue
fi
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Good job, you are using the latest version docker image"
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Congrats, you are using the latest version docker image"
sleep 86400
done

0 comments on commit 8d1a326

Please sign in to comment.