commit cad695c676f02566bb70a9842203617a8e9f2205
parent 1adecdde2dd988f53ae025d636d4d99a3ed51df4
Author: lash <dev@holbrook.no>
Date: Sat, 14 May 2022 16:14:16 +0000
Update config handlnig
Diffstat:
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/chainsyncer/cli/config.py b/chainsyncer/cli/config.py
@@ -1,19 +1,15 @@
-# external imports
-from chainsyncer.cli import SyncFlag
-
-
-def process_config(config, args, flags):
+def process_config(config, arg, args, flags):
args_override = {}
args_override['SYNCER_BACKEND'] = getattr(args, 'backend')
- if flags & SyncFlag.RANGE:
+ if arg.match('range', flags):
args_override['SYNCER_OFFSET'] = getattr(args, 'offset')
args_override['SYNCER_LIMIT'] = getattr(args, 'until')
config.dict_override(args_override, 'local cli args')
- if flags & SyncFlag.HEAD:
+ if arg.match('head', flags):
config.add(getattr(args, 'keep_alive'), '_KEEP_ALIVE')
config.add(getattr(args, 'head'), '_HEAD')