This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_run_files.py
executable file
·60 lines (53 loc) · 1.71 KB
/
generate_run_files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
import secrets
def main():
"""."""
pwd_sharing = secrets.token_hex(32)
pwd_request = secrets.token_hex(32)
pwd_postgres = secrets.token_hex(32)
api_tokens = [f"{secrets.token_hex(64)}," for _ in range(0, 3)]
pwd_redis = secrets.token_hex(32)
print("Generating environment variables...")
with open("envs.sh", "w") as envs:
envs.write(
f"""\
SHARING_PASSWORD={pwd_sharing}
REQUEST_PASSWORD={pwd_request}
POSTGRES_PASSWORD={pwd_postgres}
SHARING_DB_HOST=database
SHARING_DB_PASSWORD={pwd_sharing}
REQUEST_DB_HOST=database
REQUEST_DB_PASSWORD={pwd_request}
OS_AUTH_URL="https://pouta.csc.fi:5001/v3"
BROWSER_START_SHARING_ENDPOINT_URL=http://192.168.200.22:9090
BROWSER_START_SHARING_INT_ENDPOINT_URL=http://sharing:9090
BROWSER_START_REQUEST_ENDPOINT_URL=http://192.168.200.22:9091
BROWSER_START_REQUEST_INT_ENDPOINT_URL=http://request:9091
BROWSER_START_RUNNER_ENDPOINT=http://download:9092
BROWSER_START_RUNNER_EXT_ENDPOINT=http://192.168.200.22:9092
SWIFT_UI_API_AUTH_TOKENS={"".join(api_tokens).rstrip(",")}
SWIFT_UI_SHARING_REQUEST_TOKEN={api_tokens[0].rstrip(",")}
SWIFT_UI_REDIS_HOST=dbredis
SWIFT_UI_REDIS_USER="swiftui"
SWIFT_UI_REDIS_PASSWORD={pwd_redis}
UPLOAD_RUNNER_LOG_LEVEL=10
LOG_LEVEL=DEBUG
BROWSER_DEBUG=1
OS_ACCEPTED_ROLES=admin;object_store_user
OIDC_ENABLED=True
OIDC_URL=https://oidc.provider.url.com
OIDC_CLIENT_ID=to-be-set
OIDC_CLIENT_SECRET=to-be-set
OIDC_REDIRECT_URIS=http://localhost:8000/login/oidc-redirect
""",
)
print("Generating redis configuration...")
with open("redis.conf", "w") as redisconf:
redisconf.write(
f"""\
user default off
user swiftui on +@all ~* &* >{pwd_redis}
""",
)
if __name__ == "__main__":
main()