File tree Expand file tree Collapse file tree 3 files changed +79
-58
lines changed
Expand file tree Collapse file tree 3 files changed +79
-58
lines changed Original file line number Diff line number Diff line change 77import json
88import sys
99import time
10+ import os
1011from pathlib import Path
1112from typing import Dict , List , Tuple
1213from urllib .parse import urlparse
@@ -35,7 +36,16 @@ def load_realtime_data(file_path: str = "realtime.json") -> Dict:
3536 """Load and parse the realtime.json file"""
3637 try :
3738 with open (file_path , 'r' , encoding = 'utf-8' ) as f :
38- return json .load (f )
39+ content = f .read ()
40+
41+ # Replace API key placeholders with environment variables
42+ jp_api_key = os .environ .get ('JP_API_KEY' , '' )
43+ jp_challenge_api_key = os .environ .get ('JP_CHALLENGE_API_KEY' , '' )
44+
45+ content = content .replace ('{{{JP_API_KEY}}}' , jp_api_key )
46+ content = content .replace ('{{{JP_CHALLENGE_API_KEY}}}' , jp_challenge_api_key )
47+
48+ return json .loads (content )
3949 except FileNotFoundError :
4050 print (f"{ Colors .RED } Error: { file_path } not found{ Colors .RESET } " )
4151 sys .exit (1 )
Original file line number Diff line number Diff line change 2727 uses : actions/checkout@v6
2828
2929 - name : Check Realtime feeds
30+ env :
31+ JP_API_KEY : ${{ secrets.JP_API_KEY }}
32+ JP_CHALLENGE_API_KEY : ${{ secrets.JP_CHALLENGE_API_KEY }}
3033 run : python .github/scripts/check_realtime_feeds.py
3134
3235 deploy :
3740 - name : Checkout repository
3841 uses : actions/checkout@v6
3942
43+ - name : Replace API keys in realtime.json
44+ env :
45+ JP_API_KEY : ${{ secrets.JP_API_KEY }}
46+ JP_CHALLENGE_API_KEY : ${{ secrets.JP_CHALLENGE_API_KEY }}
47+ run : |
48+ sed -i "s/{{{JP_API_KEY}}}/$JP_API_KEY/g" realtime.json
49+ sed -i "s/{{{JP_CHALLENGE_API_KEY}}}/$JP_CHALLENGE_API_KEY/g" realtime.json
50+
4051 - name : Set up SSH key
4152 uses : webfactory/ssh-agent@v0.9.0
4253 with :
You can’t perform that action at this time.
0 commit comments