mirror of
https://gitlab.com/manzerbredes/clusterman.git
synced 2025-04-07 04:26:25 +02:00
Minor changes
This commit is contained in:
parent
1030dd08eb
commit
6b07024cd9
1 changed files with 14 additions and 1 deletions
|
@ -3,7 +3,20 @@ import os, json
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
CONF_DIR=os.path.join(os.environ['HOME'],".clusterman/")
|
CONF_DIR=os.path.join(os.environ['HOME'],".clusterman/")
|
||||||
|
CONF_FILE=os.path.join(CONF_DIR,"clusterman.json")
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Path(self.CONF_DIR).mkdir(parents=True, exist_ok=True)
|
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))
|
||||||
|
|
Loading…
Add table
Reference in a new issue