summaryrefslogtreecommitdiff
path: root/clusterman
diff options
context:
space:
mode:
Diffstat (limited to 'clusterman')
-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))