chainqueue

Blockchain transaction queue control
Log | Files | Refs | LICENSE

commit 94bd5c8cdf5302e365314ab0b39c658691935296
parent ccbbcc2157573c64eabaf3cc2cf8625d9ed99d70
Author: lash <dev@holbrook.no>
Date:   Thu, 28 Apr 2022 12:37:08 +0000

Add cli handling and settings

Diffstat:
Achainqueue/cli/__init__.py | 11+++++++++++
Achainqueue/cli/arg.py | 2++
Achainqueue/cli/config.py | 8++++++++
Mchainqueue/data/config/config.ini | 11++---------
Achainqueue/settings.py | 8++++++++
Msetup.cfg | 5+++--
6 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/chainqueue/cli/__init__.py b/chainqueue/cli/__init__.py @@ -0,0 +1,11 @@ +# standard imports +import os + +# local imports +from .arg import process_flags +from .config import process_config + + +__script_dir = os.path.dirname(os.path.realpath(__file__)) +data_dir = os.path.join(os.path.dirname(__script_dir), 'data') +config_dir = os.path.join(data_dir, 'config') diff --git a/chainqueue/cli/arg.py b/chainqueue/cli/arg.py @@ -0,0 +1,2 @@ +def process_flags(argparser, flags): + argparser.add_argument('--backend', type=str, help='Backend to use for state store') diff --git a/chainqueue/cli/config.py b/chainqueue/cli/config.py @@ -0,0 +1,8 @@ +def process_config(config, args, flags): + args_override = {} + + args_override['QUEUE_BACKEND'] = getattr(args, 'backend') + + config.dict_override(args_override, 'local cli args') + + return config diff --git a/chainqueue/data/config/config.ini b/chainqueue/data/config/config.ini @@ -1,9 +1,2 @@ -[database] -name = -engine = -driver = -host = -port = -user = -password = -debug = 0 +[queue] +backend = mem diff --git a/chainqueue/settings.py b/chainqueue/settings.py @@ -0,0 +1,8 @@ +# external imports +from chainlib.settings import ChainSettings + + +class ChainqueueSettings(ChainSettings): + + def process_queue_backend(self, config): + self.o['QUEUE_BACKEND'] = config.get('QUEUE_BACKEND') diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainqueue -version = 0.1.2 +version = 0.1.3 description = Generic blockchain transaction queue control author = Louis Holbrook author_email = dev@holbrook.no @@ -25,7 +25,7 @@ licence_files = LICENSE.txt [options] -python_requires = >= 3.6 +python_requires = >= 3.7 include_package_data = True packages = chainqueue @@ -33,6 +33,7 @@ packages = chainqueue.unittest chainqueue.store chainqueue.runnable + chainqueue.cli #[options.entry_points] #console_scripts =