Add cli handling and settings
This commit is contained in:
parent
ccbbcc2157
commit
94bd5c8cdf
11
chainqueue/cli/__init__.py
Normal file
11
chainqueue/cli/__init__.py
Normal 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
2
chainqueue/cli/arg.py
Normal 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
8
chainqueue/cli/config.py
Normal 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
|
@ -1,9 +1,2 @@
|
||||
[database]
|
||||
name =
|
||||
engine =
|
||||
driver =
|
||||
host =
|
||||
port =
|
||||
user =
|
||||
password =
|
||||
debug = 0
|
||||
[queue]
|
||||
backend = mem
|
||||
|
8
chainqueue/settings.py
Normal file
8
chainqueue/settings.py
Normal 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')
|
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user