From 75e512ee07388178c84e47a7dd91c5a12472d134 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 21 Jun 2020 14:20:46 +0100 Subject: [PATCH] Updated init script --- README.md | 4 +++- conf/etc/cont-init.d/50-speedtest | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa9f2392..417c8d51 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Disclaimer: You will need to accept Ookla's [EULA](https://www.speedtest.net/abo - Automatically run a speedtest every hour - Graph of previous speedtests going back x days - Backup/restore data in JSON/CSV format -- Slack/Discord notifications +- Slack/Discord/Telegram notifications - Organizr integration ## Usage @@ -41,6 +41,8 @@ Container images are configured using parameters passed at runtime (such as thos | `-v /config` | All the config files reside here. | | `-e OOKLA_EULA_GDPR` | Set to 'true' to accept the Ookla [EULA](https://www.speedtest.net/about/eula) and privacy agreement. If this is not set, the container will not start | | `-e SLACK_WEBHOOK` | Optional. Put a slack webhook here to get slack notifications when a speedtest is run. To use discord webhooks, just append `/slack` to the end of your discord webhook URL | +| `-e TELEGRAM_BOT_TOKEN` | Optional. Telegram bot API token. | +| `-e TELEGRAM_CHAT_ID` | Optional. Telegram chat ID. | | `-e PUID` | Optional. Supply a local user ID for volume permissions | | `-e PGID` | Optional. Supply a local group ID for volume permissions | diff --git a/conf/etc/cont-init.d/50-speedtest b/conf/etc/cont-init.d/50-speedtest index 7a3f38e5..82ac0e93 100644 --- a/conf/etc/cont-init.d/50-speedtest +++ b/conf/etc/cont-init.d/50-speedtest @@ -78,6 +78,16 @@ else sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=$SLACK_WEBHOOK," -i.bak /config/www/.env fi +if [ -z ${TELEGRAM_BOT_TOKEN+x} ] && [ -z ${TELEGRAM_CHAT_ID+x} ]; then + echo "Telegram chat id and bot token unset" + sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=," -i.bak /config/www/.env + sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=," -i.bak /config/www/.env +else + echo "Telegram chat id and bot token set, updating .env" + sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN," -i.bak /config/www/.env + sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID," -i.bak /config/www/.env +fi + if [ -z ${BASE_PATH+x} ]; then echo "Base path is unset" sed "s,BASE_PATH=.*,BASE_PATH=," -i.bak /config/www/.env