diff options
-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( |