From 13e768510ede129c654e7cfb1915f236153b7154 Mon Sep 17 00:00:00 2001 From: Christopher Ostrouchov Date: Fri, 7 Apr 2023 11:32:21 -0400 Subject: [PATCH] Adding fixes for making conda-store-ui configurable from conda-store (#451) --- .../server/templates/conda-store-ui.html | 12 ++++++++++++ .../conda_store_server/server/templates/user.html | 2 +- conda-store-server/hatch_build.py | 13 +++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/conda-store-server/conda_store_server/server/templates/conda-store-ui.html b/conda-store-server/conda_store_server/server/templates/conda-store-ui.html index 239325011..3ab2d13ef 100644 --- a/conda-store-server/conda_store_server/server/templates/conda-store-ui.html +++ b/conda-store-server/conda_store_server/server/templates/conda-store-ui.html @@ -4,6 +4,18 @@ conda-store + diff --git a/conda-store-server/conda_store_server/server/templates/user.html b/conda-store-server/conda_store_server/server/templates/user.html index 496078e13..9c7f06259 100644 --- a/conda-store-server/conda_store_server/server/templates/user.html +++ b/conda-store-server/conda_store_server/server/templates/user.html @@ -8,7 +8,7 @@
User
-
+
diff --git a/conda-store-server/hatch_build.py b/conda-store-server/hatch_build.py index 4b154ad5d..f73b7ae7d 100644 --- a/conda-store-server/hatch_build.py +++ b/conda-store-server/hatch_build.py @@ -4,6 +4,7 @@ import pathlib import urllib.request import shutil +import re from hatchling.builders.hooks.plugin.interface import BuildHookInterface @@ -56,3 +57,15 @@ def initialize(self, version: str, build_data: Dict[str, Any]) -> None: source_directory / filename, destination_directory / filename, ) + + # dirty modifications (bound to break eventually!) to + # main.js to enable easy configuration see + # conda_store_server/server/templates/conda-store-ui.html + # for global variable set + with (source_directory / "main.js").open("r") as source_f: + content = source_f.read() + content = re.sub( + '"MISSING_ENV_VAR"', "GLOBAL_CONDA_STORE_STATE", content + ) + with (destination_directory / "main.js").open("w") as dest_f: + dest_f.write(content)