File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11
11
12
12
app = Flask (__name__ )
13
13
14
+ # The repos.json file should be readable by the user running the Flask app,
15
+ # and the absolute path should be given by this environment variable.
16
+ REPOS_JSON_PATH = os .environ ['FLASK_GITHUB_WEBHOOK_REPOS_JSON' ]
17
+
14
18
15
19
@app .route ("/" , methods = ['GET' , 'POST' ])
16
20
def index ():
17
21
# Store the IP address blocks that github uses for hook requests.
18
22
hook_blocks = requests .get ('https://api.github.com/meta' ).json ()['hooks' ]
19
23
20
24
if request .method == 'GET' :
21
- return ' Nothing to see here, move along ... '
25
+ return ''
22
26
23
27
elif request .method == 'POST' :
24
28
# Check if the POST request if from github.com
@@ -34,7 +38,7 @@ def index():
34
38
if request .headers .get ('X-GitHub-Event' ) != "push" :
35
39
return json .dumps ({'msg' : "wrong event type" })
36
40
37
- repos = json .loads (io .open ('repos.json' , 'r' ).read ())
41
+ repos = json .loads (io .open (REPOS_JSON_PATH , 'r' ).read ())
38
42
39
43
payload = json .loads (request .data )
40
44
repo_meta = {
File renamed without changes.
You can’t perform that action at this time.
0 commit comments