Check if servers.json exists before creating

This commit is contained in:
Elliot Matson 2022-07-31 15:00:39 -05:00
parent b59b16ceb2
commit 253da228f7

View File

@ -2,6 +2,12 @@ import json
import os import os
import time import time
# quit if config file already exists
if os.path.exists("/config/servers.json"):
print("/config/servers.json already exists. Quitting...")
quit()
# open json file in docker volume # open json file in docker volume
with open("/config/servers.json", "w") as f: with open("/config/servers.json", "w") as f:
print("created " + f.name) print("created " + f.name)
@ -18,6 +24,8 @@ with open("/config/servers.json", "w") as f:
print(data) print(data)
# update config file # update config file
json.dump(data, f, indent=2) json.dump(data, f, indent=2)
# Sleep until GHA Healthchecks are complete. # Sleep until GHA Healthchecks are complete.
# I'm sure there's a better way to get this to not # I'm sure there's a better way to get this to not
# stall a docker-compose up --wait, but I don't know # stall a docker-compose up --wait, but I don't know