-
Notifications
You must be signed in to change notification settings - Fork 2
/
secrets_configure.py
31 lines (22 loc) · 950 Bytes
/
secrets_configure.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
import os
from configparser import ConfigParser
Import('projenv')
path = os.path.abspath('config/secrets.ini')
if os.path.exists(path):
print(f"secrets.ini found at {path}, parsing")
config = ConfigParser()
config.read('config/secrets.ini')
if config.get("secret", "loki_logging_enabled") == 'true':
print("Loki logging is enabled, configuring")
loki_url = config.get("secret", "loki_url")
loki_username = config.get("secret", "loki_username")
loki_password = config.get("secret", "loki_password")
projenv.Append(CPPDEFINES=[
("LOKI_LOGGING_ENABLED", "true"),
("LOKI_URL", projenv.StringifyMacro(loki_url)),
("LOKI_USERNAME", projenv.StringifyMacro(loki_username)),
("LOKI_PASSWORD", projenv.StringifyMacro(loki_password)),
])
print(f"Loki logging CPPDEFINES are set")
else:
print("Loki logging is disabled")