use encryptedKey in config.json if it exists

main
Paul Feitzinger 5 months ago
parent 212f119d31
commit 4e3066be0f

@ -31,7 +31,17 @@ class Message:
def get_decryption_key(path):
with open(path) as fh:
config = json.load(fh)
return config['key']
key = None
if 'key' in config and 'encryptedKey' in config:
raise Exception('config has both key and encryptedKey in it')
if 'key' in config:
key = 'key'
elif 'encryptedKey' in config:
key = 'encryptedKey'
else:
dict_keys = ', '.join(str(x) for x in config.keys())
raise Exception(f'no key found for db in config.json, only saw: {dict_keys}')
return config[key]
def query_signal_db(db, key, query):

Loading…
Cancel
Save