From 6542fd9e2c814e9da2a3ffa3f4ba299945da8aa0 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 19 Sep 2020 14:23:23 +0200 Subject: [PATCH] Only create table if not exist --- CHANGELOG | 4 ++++ crypto_dev_signer/keystore/postgres.py | 4 ++-- scripts/crypto-dev-daemon | 2 +- setup.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e4f4b2e..20769b5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +* 0.1.1 + - Create key table only if not exist +* 0.1.0 + - Add web3 ext middleware capturing signer requests * 0.0.1 - Introduce signer, transaction, keystore packages - Add test for keystore and signer diff --git a/crypto_dev_signer/keystore/postgres.py b/crypto_dev_signer/keystore/postgres.py index 2e1854f..9adc16b 100644 --- a/crypto_dev_signer/keystore/postgres.py +++ b/crypto_dev_signer/keystore/postgres.py @@ -28,13 +28,13 @@ def to_bytes(x): class ReferenceKeystore(Keystore): schema = [ - """CREATE TABLE ethereum ( + """CREATE TABLE IF NOT EXISTS ethereum ( id SERIAL NOT NULL PRIMARY KEY, key_ciphertext VARCHAR(256) NOT NULL, wallet_address_hex CHAR(40) NOT NULL ); """, - """CREATE UNIQUE INDEX ethereum_address_idx ON ethereum ( wallet_address_hex ); + """CREATE UNIQUE INDEX IF NOT EXISTS ethereum_address_idx ON ethereum ( wallet_address_hex ); """, ] diff --git a/scripts/crypto-dev-daemon b/scripts/crypto-dev-daemon index 5f79456..67faff4 100755 --- a/scripts/crypto-dev-daemon +++ b/scripts/crypto-dev-daemon @@ -139,7 +139,7 @@ def init(): kw = { 'symmetric_key': secret, } - db = ReferenceKeystore('cic_signer', **kw) + db = ReferenceKeystore(os.environ.get('SIGNER_DATABASE', 'cic_signer'), **kw) signer = ReferenceSigner(db) diff --git a/setup.py b/setup.py index efb789d..1086102 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name="crypto-dev-signer", - version="0.1.0", + version="0.1.1", description="A signer and keystore daemon and library for cryptocurrency software development", author="Louis Holbrook", author_email="dev@holbrook.no",