aboutsummaryrefslogtreecommitdiff
path: root/gn3/settings.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-10-19 10:35:32 +0300
committerFrederick Muriuki Muriithi2021-10-19 10:35:32 +0300
commitd603df2b7a50167319c8e26e101e29cef55b3a7a (patch)
treee1b3c6a22a47834a50d6eaaf70544b4dce4a335e /gn3/settings.py
parentefb9896464f969de4fe8fcaee21a19ac1d881fa2 (diff)
parent546b37e77c11c5268aa9510b9756f2ed4d60241d (diff)
downloadgenenetwork3-d603df2b7a50167319c8e26e101e29cef55b3a7a.tar.gz
Merge branch 'main' of github.com:genenetwork/genenetwork3 into partial-correlations
Diffstat (limited to 'gn3/settings.py')
-rw-r--r--gn3/settings.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/gn3/settings.py b/gn3/settings.py
index 150d96d..d5f1d3c 100644
--- a/gn3/settings.py
+++ b/gn3/settings.py
@@ -35,10 +35,18 @@ GENOTYPE_FILES = os.environ.get(
"GENOTYPE_FILES", "{}/genotype_files/genotype".format(os.environ.get("HOME")))
# CROSS-ORIGIN SETUP
-CORS_ORIGINS = [
+def parse_env_cors(default):
+ """Parse comma-separated configuration into list of strings."""
+ origins_str = os.environ.get("CORS_ORIGINS", None)
+ if origins_str:
+ return [
+ origin.strip() for origin in origins_str.split(",") if origin != ""]
+ return default
+
+CORS_ORIGINS = parse_env_cors([
"http://localhost:*",
"http://127.0.0.1:*"
-]
+])
CORS_HEADERS = [
"Content-Type",