offload the json files to a remote location

This commit is contained in:
Greg Gauthier 2019-03-13 14:27:21 +00:00
parent b4bb300203
commit b0077dac7b
2 changed files with 6 additions and 7 deletions

View File

@ -1 +1 @@
{"pwdfilename": "eg/pwdfile.json", "secret": "5MrW89mydi5SU9X0w7nSFlk-g5ERyKDlN4-N2z6ZR7M="} {"pwdfilename": "/Volumes/GMGAUTHIER/keys/pwdfile.json", "secret": null}

View File

@ -3,6 +3,7 @@ import json
class Config: class Config:
def __init__(self): def __init__(self):
self.cfg_file = '/Volumes/GMGAUTHIER/keys/pwdtools/config.json'
self.data = self.read() self.data = self.read()
def get_pwdfilename(self): def get_pwdfilename(self):
@ -19,12 +20,10 @@ class Config:
self.data["secret"] = secret self.data["secret"] = secret
self.write(self.data) self.write(self.data)
@staticmethod def read(self):
def read(): with open(self.cfg_file, mode="r") as cfgfile:
with open('cfg/config.json', mode="r") as cfgfile:
return json.load(cfgfile) return json.load(cfgfile)
@staticmethod def write(self, keys):
def write(keys): with open(self.cfg_file, mode="w") as cfgfile:
with open('cfg/config.json', mode="w") as cfgfile:
cfgfile.write(json.dumps(keys)) cfgfile.write(json.dumps(keys))