commit 6da2a1ced91b798f4cb3b8510f4d8b6835f31566
parent 9f2a791b1f26d3117b83547d2b78e1f36177293f
Author: lash <dev@holbrook.no>
Date: Sat, 14 May 2022 12:24:20 +0000
Update config processing
Diffstat:
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/chaind/cli/config.py b/chaind/cli/config.py
@@ -1,23 +1,19 @@
-# external imports
-from chaind.cli import ChaindFlag
-
-
-def process_config(config, args, flags):
+def process_config(config, arg, args, flags):
args_override = {}
- if flags & ChaindFlag.SESSION:
+ if arg.match('session', flags):
args_override['SESSION_ID'] = getattr(args, 'session_id')
args_override['SESSION_RUNTIME_DIR'] = getattr(args, 'runtime_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')
- if flags & ChaindFlag.TOKEN:
+ if arg.match('token', flags):
args_override['TOKEN_MODULE'] = getattr(args, 'token_module')
config.dict_override(args_override, 'local cli args')
- if flags & ChaindFlag.SOCKET_CLIENT:
- config.add(getattr(args, 'socket_send'), '_SOCKET_SEND', False)
+ if arg.match('socket_client', flags):
+ config.add(getattr(args, 'send_socket'), '_SOCKET_SEND', False)
return config
diff --git a/chaind/settings.py b/chaind/settings.py
@@ -28,7 +28,7 @@ def process_session(settings, config):
base_dir = os.getcwd()
data_dir = config.get('SESSION_DATA_PATH')
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'))
os.makedirs(data_engine_dir, exist_ok=True)