-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_client.py
More file actions
31 lines (24 loc) · 877 Bytes
/
setup_client.py
File metadata and controls
31 lines (24 loc) · 877 Bytes
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
import os
import re
import sys
def replace_in_file(file_path, replacements):
with open(file_path, 'r') as file:
content = file.read()
for key, value in replacements.items():
pattern = rf'{key}\s*=\s*"([^"]*)"'
replacement = f'{key}="{value}"'
content = re.sub(pattern, replacement, content)
with open(file_path, 'w') as file:
file.write(content)
if __name__ == '__main__':
service_url_scheme = os.environ.get('AUGMENTATION_SERVICE_URL_SCHEME')
service_host = os.environ.get('AUGMENTATION_SERVICE_HOST')
service_port = os.environ.get('AUGMENTATION_SERVICE_PORT')
replace_in_file(
sys.argv[1],
{
'AUGMENTATION_SERVICE_URL_SCHEME': service_url_scheme,
'AUGMENTATION_SERVICE_HOST': service_host,
'AUGMENTATION_SERVICE_PORT': service_port
}
)