diff options
author | BonfaceKilz | 2021-10-20 12:28:44 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-10-25 14:00:14 +0300 |
commit | cc3ae4707d2418712d13261d4bf9d5a509169c7e (patch) | |
tree | 79c1594e2ac248354d9fa02d31ea10b029b7760c | |
parent | 182327254fe2964c3dd41aabe49ab99748800a64 (diff) | |
download | genenetwork2-cc3ae4707d2418712d13261d4bf9d5a509169c7e.tar.gz |
Add "GN2_PROXY" as a configurable option
-rw-r--r-- | etc/default_settings.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/decorators.py | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/etc/default_settings.py b/etc/default_settings.py index 651cc55e..8636f4db 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -29,6 +29,9 @@ GN_VERSION = open("../etc/VERSION", "r").read() # Redis REDIS_URL = "redis://:@localhost:6379/0" +# gn2-proxy +GN2_PROXY = "http://localhost:8080" + # ---- MySQL SQL_URI = "mysql://gn2:mysql_password@localhost/db_webqtl_s" diff --git a/wqflask/wqflask/decorators.py b/wqflask/wqflask/decorators.py index 13867cda..edbea90f 100644 --- a/wqflask/wqflask/decorators.py +++ b/wqflask/wqflask/decorators.py @@ -5,6 +5,7 @@ import redis from flask import current_app, g from typing import Dict +from urllib.parse import urljoin from functools import wraps from wqflask.access_roles import DataRole @@ -56,8 +57,10 @@ def edit_access_required(f): _user_id = g.user_session.record.get(b"user_id", "").decode("utf-8") response = json.loads( - requests.get(GN_PROXY_URL + "available?resource=" - f"{resource_id}&user={_user_id}").content) + requests.get(urljoin( + current_app.config.get("GN2_PROXY"), + ("available?resource=" + f"{resource_id}&user={_user_id}"))).content) except: response = {} if max([DataRole(role) for role in response.get( |