Outfleet::fix empty config

This commit is contained in:
2024-04-17 20:13:10 +03:00
parent f6bcb42ec4
commit 5cc32b18af
2 changed files with 13 additions and 4 deletions

11
lib.py
View File

@ -33,10 +33,19 @@ def get_config():
try:
with open(args.config, "r") as file:
config = yaml.safe_load(file)
if config == None:
config = {
"servers": {},
"clients": {}
}
except:
try:
with open(args.config, "w"):
pass
config = {
"servers": {},
"clients": {}
}
yaml.safe_dump(config, file)
except Exception as exp:
log.error(f"Couldn't create config. {exp}")
return None