summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-10-25 16:08:42 +0200
committerLoic Guegan <loic.guegan@mailbox.org>2023-10-25 16:08:42 +0200
commit6b07024cd93742dacfaf9d151e888f058615486f (patch)
treef158554e4af577db4e09f76462152b61c7274ec9
parent1030dd08ebe9137b01754e85ad7c9ae4182f29aa (diff)
Minor changes
-rw-r--r--clusterman/config.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/clusterman/config.py b/clusterman/config.py
index 04cac10..761efdf 100644
--- a/clusterman/config.py
+++ b/clusterman/config.py
@@ -3,7 +3,20 @@ import os, json
class Config:
CONF_DIR=os.path.join(os.environ['HOME'],".clusterman/")
+ CONF_FILE=os.path.join(CONF_DIR,"clusterman.json")
def __init__(self):
Path(self.CONF_DIR).mkdir(parents=True, exist_ok=True)
- print(self.CONF_DIR)
+ self.load()
+
+ def load(self):
+ self.config={"example":None}
+ if os.path.exists(self.CONF_FILE):
+ with open(self.CONF_FILE) as f:
+ self.config=json.load(f)
+ else:
+ self.save()
+
+ def save(self):
+ with open(self.CONF_FILE, "w") as f:
+ f.write(json.dumps(self.config))