From 62f26b901e49effb0105e517093fd873815c470c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Sat, 25 Sep 2021 05:22:23 +0300 Subject: Remove hard-coded URL; use configured URL Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * etc/default_settings.py: remove duplicate configuration variable * wqflask/wqflask/collect.py: use the configured url for the API server Use the configured URL rather that the hard-coded URL that was used for testing out the clustered heatmap generation. --- etc/default_settings.py | 1 - 1 file changed, 1 deletion(-) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index a194b10e..023aa53b 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -25,7 +25,6 @@ import os import sys GN_VERSION = open("../etc/VERSION", "r").read() -GN_SERVER_URL = "http://localhost:8880/" # REST API server # ---- MySQL -- cgit v1.2.3 From 2f26b77c7be370dad03e9b8e2ce7f6040ccce528 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 12 Oct 2021 14:19:03 +0300 Subject: Add default setting for REDIS_URL --- etc/default_settings.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index 023aa53b..651cc55e 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -26,6 +26,9 @@ import sys GN_VERSION = open("../etc/VERSION", "r").read() +# Redis +REDIS_URL = "redis://:@localhost:6379/0" + # ---- MySQL SQL_URI = "mysql://gn2:mysql_password@localhost/db_webqtl_s" -- cgit v1.2.3 From cc3ae4707d2418712d13261d4bf9d5a509169c7e Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 20 Oct 2021 12:28:44 +0300 Subject: Add "GN2_PROXY" as a configurable option --- etc/default_settings.py | 3 +++ wqflask/wqflask/decorators.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'etc') 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( -- cgit v1.2.3