Normalize frontend API host URLs
This commit is contained in:
1 parent
f8fb871bcc
commit
fa526eba02
2 files changed
+22
No files matched your search
@@ -11,6 +11,7 @@ RUN apt-get update \
|
|||||||
g++ \
|
g++ \
|
||||||
libmariadb-dev \
|
libmariadb-dev \
|
||||||
make \
|
make \
|
||||||
|
patch \
|
||||||
patchelf \
|
patchelf \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
@@ -18,6 +19,9 @@ RUN apt-get update \
|
|||||||
COPY upstream/HubBackend/requirements.txt upstream/HubBackend/makefile ./
|
COPY upstream/HubBackend/requirements.txt upstream/HubBackend/makefile ./
|
||||||
COPY upstream/HubBackend/src ./src
|
COPY upstream/HubBackend/src ./src
|
||||||
COPY upstream/HubBackend/config_sample.json upstream/HubBackend/openapi.json ./
|
COPY upstream/HubBackend/config_sample.json upstream/HubBackend/openapi.json ./
|
||||||
|
COPY docker/client-config.patch ./docker/client-config.patch
|
||||||
|
|
||||||
|
RUN patch -p1 < docker/client-config.patch
|
||||||
|
|
||||||
# Compile the binaries from the backend source code. Cache the build data.
|
# Compile the binaries from the backend source code. Cache the build data.
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
--- a/src/external_plugins/client-config.py
|
||||||
|
+++ b/src/external_plugins/client-config.py
|
||||||
|
@@ -17,0 +18,6 @@
|
||||||
|
+def normalize_client_config(config):
|
||||||
|
+ if not config["api_host"].startswith(("http://", "https://")):
|
||||||
|
+ config["api_host"] = f"https://{config['api_host']}"
|
||||||
|
+ return config
|
||||||
|
+
|
||||||
|
+
|
||||||
|
@@ -24 +30 @@
|
||||||
|
- return json.loads(config)
|
||||||
|
+ return normalize_client_config(json.loads(config))
|
||||||
|
@@ -37 +43 @@
|
||||||
|
- config = json.loads(t[0][0])
|
||||||
|
+ config = normalize_client_config(json.loads(t[0][0]))
|
||||||
|
@@ -298 +304 @@
|
||||||
|
- "api_host": config["domain"],
|
||||||
|
+ "api_host": f"https://{config['domain']}",
|
||||||
Reference in new issue
Block a user