From c3f39933fa4e0b4d69c45444fbcc08f13e1b7766 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Tue, 18 Sep 2018 12:23:51 -0400 Subject: [PATCH] add CORS (#99) - fix the Makefile - add CORS package dependency - add CORS to all endpoints The CI does not serve secret information so accessing it from arbitrary domains is not a problem. --- Makefile | 3 ++- ci/ci.py | 2 ++ environment.yml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3ecda02cd12..bb857b100ec 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,8 @@ restart-batch-proxy: | head -n 1)) kubectl port-forward ${BATCH_POD} 8888:5000 > batch-proxy.log 2>batch-proxy.err & echo $$! > batch-proxy.pid -run-local: HAIL_CI_REMOTE_PORT = 3000 restart-all-proxies +run-local: HAIL_CI_REMOTE_PORT = 3000 +run-local: restart-all-proxies SELF_HOSTNAME=http://35.232.159.176:${HAIL_CI_REMOTE_PORT} \ BATCH_SERVER_URL=http://127.0.0.1:${HAIL_CI_LOCAL_BATCH_PORT} \ source activate hail-ci && python ci/ci.py diff --git a/ci/ci.py b/ci/ci.py index d586d7ad81e..9e3d26252c6 100644 --- a/ci/ci.py +++ b/ci/ci.py @@ -8,6 +8,7 @@ WATCHED_TARGETS, \ REFRESH_INTERVAL_IN_SECONDS from flask import Flask, request, jsonify +from flask_cors import CORS from git_state import Repo, FQRef, FQSHA from github import open_pulls, overall_review_state, latest_sha_for_ref from google_storage import \ @@ -27,6 +28,7 @@ prs = PRS({k: v for [k, v] in WATCHED_TARGETS}) app = Flask(__name__) +CORS(app) @app.errorhandler(BadStatus) diff --git a/environment.yml b/environment.yml index ef539f7f7b2..0fe103f6353 100644 --- a/environment.yml +++ b/environment.yml @@ -8,3 +8,4 @@ dependencies: - pip - pip: - google-cloud-storage + - flask-cors