This commit is contained in:
lm
2021-11-07 15:25:35 +01:00
parent 5c0d179f46
commit 153c08d37f
4 changed files with 219 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
[Connection]
host = "myexamplecloud.com"
[Auth]
user = "exampleuser"
password = "examplepassword"
[Other]
savepath = "Zips/"
zippw = ""
+53
View File
@@ -0,0 +1,53 @@
"""
TBD
"""
__author__ = "Lukas Mahler"
__version__ = "0.0.0"
__date__ = "13.10.2021"
__email__ = "m@hler.eu"
__status__ = "Development"
# Default
import shutil
import os.path
# Custom
import toml
def getConf(fname):
"""
"""
if fname.endswith(".toml"):
if os.path.isfile(fname):
try:
config = toml.load(fname)
checkConf(config)
return config
except ValueError as e:
print(f"The provided '.toml' is probably invalid, returned error:\n{e}")
exit(1)
else:
print(f"Couldn't locate the '.toml' file [{fname}].")
print("Creating a new '.toml' file from template, please edit and restart.")
shutil.copy("src/template.toml", fname)
exit(1)
else:
print(f"The provided config file [{fname}] is not a '.toml' file.")
print("Creating a new '.toml' file from template, please edit and restart.")
shutil.copy("src/template.toml", "prod.toml")
exit(1)
def checkConf(config):
"""
TODO check if keys exist
"""
pass
if __name__ == "__main__":
exit()