Skip to content

Commit 604f127

Browse files
FiveYellowMiceiovxw
authored andcommitted
Allow token to be specified via env var
1 parent 4e70fe7 commit 604f127

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ OPTIONS:
6363
--min-interval <seconds> Minimum fetch interval [default: 300]
6464
6565
ARGS:
66-
<token> Telegram bot token
66+
<token> Telegram bot token [env: RSSBOT_TOKEN]
6767
6868
NOTE: You can get <user id> using bots like @userinfobot @getidsbot
6969
```
@@ -72,6 +72,7 @@ Please read the [official docs](https://core.telegram.org/bots#3-how-do-i-create
7272

7373
## Environment variables
7474

75+
- `RSSBOT_TOKEN`: Telegram bot token
7576
- `HTTP_PROXY`: Proxy for HTTP
7677
- `HTTPS_PROXY`: Proxy for HTTPS
7778
- `RSSBOT_DONT_PROXY_FEEDS`: Set to `1` to limit the proxy to Telegram requests

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ OPTIONS:
6161
--min-interval <seconds> Minimum fetch interval [default: 300]
6262
6363
ARGS:
64-
<token> Telegram bot token
64+
<token> Telegram bot token [env: RSSBOT_TOKEN]
6565
6666
NOTE: You can get <user id> using bots like @userinfobot @getidsbot
6767
```
@@ -70,6 +70,7 @@ NOTE: You can get <user id> using bots like @userinfobot @getidsbot
7070

7171
## 环境变量
7272

73+
- `RSSBOT_TOKEN`: Telegram bot token
7374
- `HTTP_PROXY`: 用于 HTTP 的代理
7475
- `HTTPS_PROXY`: 用于 HTTPS 的代理
7576
- `RSSBOT_DONT_PROXY_FEEDS`: 设为 `1` 使所有订阅的 RSS 不通过代理(仅代理 Telegram)

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ static BOT_ID: OnceLock<tbot::types::user::Id> = OnceLock::new();
3939
)]
4040
pub struct Opt {
4141
/// Telegram bot token
42+
#[structopt(
43+
env = "RSSBOT_TOKEN",
44+
hide_env_values = true
45+
)]
4246
token: String,
4347
/// Path to database
4448
#[structopt(

0 commit comments

Comments
 (0)