Docker-Davinci-Resolve-Proj.../pgadmin-config-creator/app.py

18 lines
599 B
Python
Raw Normal View History

2022-07-30 03:13:47 +00:00
import json
import os
2022-07-30 04:31:17 +00:00
import time
2022-07-30 03:13:47 +00:00
2022-07-30 04:56:28 +00:00
with open("/config/servers.json", "w") as f:
2022-07-30 03:13:47 +00:00
print("created " + f.name)
2022-07-30 04:56:28 +00:00
template_string = (
'{"Servers": {"1": {"Name": "DavinciResolve", '
'"Group": "Servers", "Port": 5432, "Username": '
'"postgres", "Host": "postgres", "SSLMode": "prefer", "MaintenanceDB": "postgres"}}}'
)
2022-07-30 03:13:47 +00:00
data = json.loads(template_string)
2022-07-30 04:47:06 +00:00
data["Servers"]["1"]["Username"] = os.getenv("POSTGRES_USER")
2022-07-30 04:31:17 +00:00
print("printing json to file...")
2022-07-30 03:13:47 +00:00
print(data)
2022-07-30 04:31:17 +00:00
json.dump(data, f, indent=2)
# sleep until GHA Healthchecks are complete
2022-07-30 04:47:06 +00:00
time.sleep(125)