Add state settings and config

This commit is contained in:
lash 2022-05-13 13:44:15 +00:00
parent e225b4e333
commit 9f537ff569
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 19 additions and 2 deletions

View File

@ -67,6 +67,8 @@ class ArgFlag(BaseArgFlag):
self.add('fmt_wire') self.add('fmt_wire')
self.add('fmt_rpc') self.add('fmt_rpc')
self.add('veryverbose') self.add('veryverbose')
self.add('path')
self.add('backend')
self.alias('sign', 'key_file', 'send') self.alias('sign', 'key_file', 'send')
self.alias('std_base', 'verbose', 'config', 'raw', 'env', 'target') self.alias('std_base', 'verbose', 'config', 'raw', 'env', 'target')
@ -74,7 +76,7 @@ class ArgFlag(BaseArgFlag):
self.alias('std_read', 'std_base', 'provider', 'chain_spec', 'unsafe', 'seq', 'sign', 'fee', 'target') self.alias('std_read', 'std_base', 'provider', 'chain_spec', 'unsafe', 'seq', 'sign', 'fee', 'target')
self.alias('std_write', 'verbose', 'config', 'raw', 'env', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'sign', 'target', 'wait', 'wait_all', 'send', 'rpc_auth', 'nonce', 'fee') self.alias('std_write', 'verbose', 'config', 'raw', 'env', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'sign', 'target', 'wait', 'wait_all', 'send', 'rpc_auth', 'nonce', 'fee')
self.alias('std_target', 'no_target', 'exec', 'wallet') self.alias('std_target', 'no_target', 'exec', 'wallet')
self.alias('state', 'backend', 'path')
class Arg(BaseArg): class Arg(BaseArg):
@ -109,7 +111,6 @@ class Arg(BaseArg):
self.add_long('rpc-timeout', 'provider', help='RPC autentication credential values') self.add_long('rpc-timeout', 'provider', help='RPC autentication credential values')
self.add_long('rpc-proxy', 'provider', help='RPC autentication credential values') self.add_long('rpc-proxy', 'provider', help='RPC autentication credential values')
#self.add_long('height', 'no_target', default='latest', help='Block height to execute against')
self.add_long('height', 'target', default='latest', help='Block height to execute against') self.add_long('height', 'target', default='latest', help='Block height to execute against')
self.add_long('rpc-auth', 'rpc_auth', help='RPC autentication scheme') self.add_long('rpc-auth', 'rpc_auth', help='RPC autentication scheme')
@ -136,3 +137,7 @@ class Arg(BaseArg):
self.add_long('nonce', 'nonce', typ=int, help='override nonce') self.add_long('nonce', 'nonce', typ=int, help='override nonce')
self.add_long('fee-price', 'fee', typ=int, help='override fee price') self.add_long('fee-price', 'fee', typ=int, help='override fee price')
self.add_long('fee-limit', 'fee', typ=int, help='override fee limit') self.add_long('fee-limit', 'fee', typ=int, help='override fee limit')
self.add_long('state-path', 'path', help='Path to store state data under')
self.add_long('runtime-path', 'path', help='Path to store volatile data under')
self.add_long('backend', 'backend', help='Backend to use for data storage')

View File

@ -85,6 +85,12 @@ def process_config(config, arg, args, flags):
f.close() f.close()
config.censor('PASSPHRASE', 'WALLET') config.censor('PASSPHRASE', 'WALLET')
if arg.match('backend', flags):
args_override['STATE_BACKEND'] = getattr(args, 'backend')
if arg.match('path', flags):
args_override['STATE_PATH'] = getattr(args, 'state_path')
config.dict_override(args_override, 'cli args', allow_empty=True) config.dict_override(args_override, 'cli args', allow_empty=True)
if arg.match('provider', flags): if arg.match('provider', flags):
@ -127,4 +133,5 @@ def process_config(config, arg, args, flags):
config.add(getattr(args, 'rpc_auth'), 'RPC_AUTH') config.add(getattr(args, 'rpc_auth'), 'RPC_AUTH')
config.add(getattr(args, 'rpc_credentials'), 'RPC_CREDENTIALS') config.add(getattr(args, 'rpc_credentials'), 'RPC_CREDENTIALS')
return config return config

View File

@ -16,3 +16,8 @@ max_fee = 0
[wallet] [wallet]
key_file = key_file =
passphrase = passphrase =
[state]
path =
runtime_path =
backend =