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