Skip to content

Commit 139b0dc

Browse files
minio endpoint as argument
1 parent 1dbeecb commit 139b0dc

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

start.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@
2121
)
2222

2323
refinery_dir = sys.argv[1]
24-
is_windows = sys.argv[2].lower() == "windows"
24+
25+
if len(sys.argv) > 2:
26+
minio_endpoint = sys.argv[2]
27+
else:
28+
minio_endpoint = None
2529

2630
if wait_until_refinery_is_ready(timeout=1):
2731
print("Refinery is already running!", flush=True)
2832
sys.exit(0)
2933

3034
print("Creating docker-compose.yml file...", flush=True)
31-
minio_endpoint = process_docker_compose_template(refinery_dir, is_windows)
32-
print("Creating jwks.json secret...", flush=True)
35+
minio_endpoint = process_docker_compose_template(refinery_dir, minio_endpoint)
36+
print("Creating jwks.json secret if not existing...", flush=True)
3337
create_jwks_secret_if_not_existing()
3438
print("Checking and pulling exec env images...", flush=True)
3539
check_and_pull_exec_env_images()

util/template_processor.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
import sys
2+
import os
33

44
from util.constants import (
55
DOCKER_COMPOSE,
@@ -10,12 +10,15 @@
1010
from util.docker_helper import get_credential_ip, get_host_ip
1111

1212

13-
def process_docker_compose_template(refinery_dir: str, is_windows: bool) -> str:
13+
def process_docker_compose_template(
14+
refinery_dir: str, minio_endpoint: str = None
15+
) -> str:
1416
credential_ip = get_credential_ip()
15-
host_ip = get_host_ip()
16-
1717
cred_endpoint = f"http://{credential_ip}:7053"
18-
minio_endpoint = f"http://{host_ip}:7053"
18+
19+
if minio_endpoint is None:
20+
host_ip = get_host_ip()
21+
minio_endpoint = f"http://{host_ip}:7053"
1922

2023
with open(DOCKER_COMPOSE_TEMPLATE, "r") as f:
2124
template = f.read()
@@ -25,18 +28,8 @@ def process_docker_compose_template(refinery_dir: str, is_windows: bool) -> str:
2528

2629
with open(SETTINGS, "r") as f:
2730
settings = json.load(f)
28-
path_sep = "\\" if is_windows else "/"
29-
for volume, path in settings.items():
30-
if path.startswith(".."):
31-
print("Path in settings.json must not start with '..'!", flush=True)
32-
sys.exit(1)
33-
if path[0] == ".": # relative path
34-
path = path[1:]
35-
if path[0] != path_sep:
36-
path = path_sep + path[1:]
37-
settings[volume] = refinery_dir + path
38-
else:
39-
settings[volume] = path
31+
for volume, rel_path in settings.items():
32+
settings[volume] = os.path.normpath(os.path.join(refinery_dir, rel_path))
4033

4134
docker_compose = template.format(
4235
**versions,

0 commit comments

Comments
 (0)