File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,15 @@ def do_ping(*args, **job_info):
88
88
89
89
backend_url = os .environ .get ('BACKEND_URL' )
90
90
bot_token = os .environ .get ('BOT_TOKEN' )
91
+ if not bot_token :
92
+ # bot token can also be specified via contents of a file:
93
+ bot_token_from_file = os .environ .get ('BOT_TOKEN_FROM_FILE' )
94
+ if bot_token_from_file :
95
+ with open (bot_token_from_file , 'rt' ) as f :
96
+ bot_token = f .read ()
97
+
91
98
if not backend_url or not bot_token :
92
- raise Exception ("Please specify BACKEND_URL and BOT_TOKEN env vars." )
99
+ raise Exception ("Please specify BACKEND_URL and BOT_TOKEN / BOT_TOKEN_FROM_FILE env vars." )
93
100
jobs_refresh_interval = int (os .environ .get ('JOBS_REFRESH_INTERVAL' , 120 ))
94
101
95
102
c = PingCollector (backend_url , bot_token , jobs_refresh_interval )
You can’t perform that action at this time.
0 commit comments