-
Notifications
You must be signed in to change notification settings - Fork 1
/
update_client_configuration.py
30 lines (26 loc) · 1.16 KB
/
update_client_configuration.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
import os
def update_client_configuration(clients, env_client_props):
for client in clients:
client_id = client['clientId']
update_client_secrets(client, client_id)
if client_id not in env_client_props:
continue
else:
update_client(client, client_id, env_client_props)
def update_client_secrets(client, client_id):
if client_id == "tdr":
client['secret'] = os.environ['CLIENT_SECRET']
if client_id == "tdr-backend-checks":
client['secret'] = os.environ['BACKEND_CHECKS_CLIENT_SECRET']
if client_id == "tdr-realm-admin":
client['secret'] = os.environ['REALM_ADMIN_CLIENT_SECRET']
if client_id == "tdr-user-admin":
client['secret'] = os.environ['USER_ADMIN_CLIENT_SECRET']
if client_id == "tdr-reporting":
client['secret'] = os.environ['REPORTING_CLIENT_SECRET']
if client_id == "tdr-rotate-secrets":
client['secret'] = os.environ['ROTATE_CLIENT_SECRETS_CLIENT_SECRET']
def update_client(client, client_id, client_env_props):
client_props = client_env_props[client_id]
for key in client_props.keys():
client[key] = client_props[key]