From a75cf62ff0b4cc011c55847e8ee816f97a644fcb Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 8 Aug 2020 12:27:05 +0200 Subject: [PATCH] Add feedback on missing secret --- scripts/crypto-dev-daemon | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/crypto-dev-daemon b/scripts/crypto-dev-daemon index 5f79456..73b3ea7 100755 --- a/scripts/crypto-dev-daemon +++ b/scripts/crypto-dev-daemon @@ -20,6 +20,14 @@ signer = None chainId = 8995 +class MissingSecretError(BaseException): + + def __init__(self, message): + super(MissingSecretError, self).__init__(message) + + pass + + def personal_new_account(p): password = p if p.__class__.__name__ != 'str': @@ -134,7 +142,12 @@ def start_server(): def init(): global db, signer - secret_hex = os.environ.get('SIGNER_SECRET') + secret_hex = '' + try: + secret_hex = os.environ['SIGNER_SECRET'] + except KeyError as e: + raise MissingSecretError('please set the SIGNER_SECRET environment variable to a valid hex value') + secret = bytes.fromhex(secret_hex) kw = { 'symmetric_key': secret,