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):
8888
8989 backend_url = os .environ .get ('BACKEND_URL' )
9090 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+
9198 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." )
93100 jobs_refresh_interval = int (os .environ .get ('JOBS_REFRESH_INTERVAL' , 120 ))
94101
95102 c = PingCollector (backend_url , bot_token , jobs_refresh_interval )
You can’t perform that action at this time.
0 commit comments