passwdtools/configuration.py
Greg Gauthier 7650571ad0 refactor
2019-03-12 12:27:34 +00:00

29 lines
582 B
Python

import json
class Config:
def __init__(self):
self.data = self.read()
def get_pwdfilename(self):
return self.data["pwdfile"]
def set_pwdfilename(self):
pass
def get_secret(self):
return self.data["secret"]
def set_secret(self, secret):
pass
@staticmethod
def read():
with open('cfg/config.json', mode="r") as cfgfile:
return json.load(cfgfile)
@staticmethod
def write(keys):
with open('cfg/config.json', mode="w") as cfgfile:
cfgfile.write(json.dumps(keys))