Add cli handling and settings

This commit is contained in:
lash 2022-04-28 12:37:08 +00:00
parent ccbbcc2157
commit 94bd5c8cdf
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
6 changed files with 34 additions and 11 deletions

View File

@ -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')

2
chainqueue/cli/arg.py Normal file
View File

@ -0,0 +1,2 @@
def process_flags(argparser, flags):
argparser.add_argument('--backend', type=str, help='Backend to use for state store')

8
chainqueue/cli/config.py Normal file
View File

@ -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

View File

@ -1,9 +1,2 @@
[database]
name =
engine =
driver =
host =
port =
user =
password =
debug = 0
[queue]
backend = mem

8
chainqueue/settings.py Normal file
View File

@ -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')

View File

@ -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 =