Add cli handling and settings

This commit is contained in:
lash
2022-04-28 12:37:08 +00:00
parent ccbbcc2157
commit 94bd5c8cdf
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')