Update config processing
This commit is contained in:
parent
9f2a791b1f
commit
6da2a1ced9
@ -1,23 +1,19 @@
|
|||||||
# external imports
|
def process_config(config, arg, args, flags):
|
||||||
from chaind.cli import ChaindFlag
|
|
||||||
|
|
||||||
|
|
||||||
def process_config(config, args, flags):
|
|
||||||
args_override = {}
|
args_override = {}
|
||||||
if flags & ChaindFlag.SESSION:
|
if arg.match('session', flags):
|
||||||
args_override['SESSION_ID'] = getattr(args, 'session_id')
|
args_override['SESSION_ID'] = getattr(args, 'session_id')
|
||||||
args_override['SESSION_RUNTIME_DIR'] = getattr(args, 'runtime_dir')
|
args_override['SESSION_RUNTIME_DIR'] = getattr(args, 'runtime_dir')
|
||||||
args_override['SESSION_DATA_DIR'] = getattr(args, 'data_dir')
|
args_override['SESSION_DATA_DIR'] = getattr(args, 'data_dir')
|
||||||
|
|
||||||
if flags & ChaindFlag.SOCKET:
|
if arg.match('socket', flags):
|
||||||
args_override['SESSION_SOCKET_PATH'] = getattr(args, 'socket')
|
args_override['SESSION_SOCKET_PATH'] = getattr(args, 'socket')
|
||||||
|
|
||||||
if flags & ChaindFlag.TOKEN:
|
if arg.match('token', flags):
|
||||||
args_override['TOKEN_MODULE'] = getattr(args, 'token_module')
|
args_override['TOKEN_MODULE'] = getattr(args, 'token_module')
|
||||||
|
|
||||||
config.dict_override(args_override, 'local cli args')
|
config.dict_override(args_override, 'local cli args')
|
||||||
|
|
||||||
if flags & ChaindFlag.SOCKET_CLIENT:
|
if arg.match('socket_client', flags):
|
||||||
config.add(getattr(args, 'socket_send'), '_SOCKET_SEND', False)
|
config.add(getattr(args, 'send_socket'), '_SOCKET_SEND', False)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
@ -28,7 +28,7 @@ def process_session(settings, config):
|
|||||||
base_dir = os.getcwd()
|
base_dir = os.getcwd()
|
||||||
data_dir = config.get('SESSION_DATA_PATH')
|
data_dir = config.get('SESSION_DATA_PATH')
|
||||||
if data_dir == None:
|
if data_dir == None:
|
||||||
data_dir = os.path.join(base_dir, '.chaind', 'chaind', settings.o.get('CHAIND_BACKEND'))
|
data_dir = os.path.join(base_dir, '.chaind', 'chaind', settings.get('CHAIND_BACKEND'))
|
||||||
data_engine_dir = os.path.join(data_dir, config.get('CHAIND_ENGINE'))
|
data_engine_dir = os.path.join(data_dir, config.get('CHAIND_ENGINE'))
|
||||||
os.makedirs(data_engine_dir, exist_ok=True)
|
os.makedirs(data_engine_dir, exist_ok=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user