From 15998beb687f97efd11848082975890f5aa3bc74 Mon Sep 17 00:00:00 2001 From: Alok Saldanha Date: Sat, 7 Sep 2019 08:11:29 -0400 Subject: [PATCH] added support for GATEWAY_EXTRA_SCRIPTS --- cellxgene_gateway/env.py | 1 + cellxgene_gateway/extra_scripts.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cellxgene_gateway/env.py b/cellxgene_gateway/env.py index 5967718..3eecea6 100644 --- a/cellxgene_gateway/env.py +++ b/cellxgene_gateway/env.py @@ -14,6 +14,7 @@ cellxgene_data = os.environ.get("CELLXGENE_DATA") gateway_host = os.environ.get("GATEWAY_HOST") gateway_protocol = os.environ.get("GATEWAY_PROTOCOL") ip = os.environ.get("GATEWAY_IP") +extra_scripts = os.environ.get("GATEWAY_EXTRA_SCRIPTS") env_vars = { "CELLXGENE_LOCATION": cellxgene_location, diff --git a/cellxgene_gateway/extra_scripts.py b/cellxgene_gateway/extra_scripts.py index 439c92e..7f758fd 100644 --- a/cellxgene_gateway/extra_scripts.py +++ b/cellxgene_gateway/extra_scripts.py @@ -7,10 +7,11 @@ # OR CONDITIONS OF ANY KIND, either express or implied. See the License for # the specific language governing permissions and limitations under the License. +from cellxgene_gateway import env def get_extra_scripts(): # can be array of script tags to inject on every page, e.g. for google analytics could be # ['https://www.googletagmanager.com/gtag/js?id=UA-123456-2', # f"{env.gateway_protocol}://{env.gateway_host}/static/js/google_ua.js"] # where google_ua.js is a script you add to the static/js folder prior to deployment. - return [] + return [] if env.extra_scripts is None else [p.strip() for p in env.extra_scripts.split(",") if len(p.strip()) > 0]