max_key_fee in yaml as null
This commit is contained in:
parent
be0bd3bdea
commit
8a3b8d2df1
4 changed files with 13 additions and 9 deletions
|
@ -159,6 +159,7 @@ class Path(String):
|
||||||
class MaxKeyFee(Setting[dict]):
|
class MaxKeyFee(Setting[dict]):
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
|
if value is not None:
|
||||||
assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \
|
assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \
|
||||||
f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"."
|
f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"."
|
||||||
if value["currency"] not in CURRENCIES:
|
if value["currency"] not in CURRENCIES:
|
||||||
|
|
|
@ -176,7 +176,7 @@ def get_argument_parser():
|
||||||
help='Show lbrynet CLI version and exit.'
|
help='Show lbrynet CLI version and exit.'
|
||||||
)
|
)
|
||||||
main.set_defaults(group=None, command=None)
|
main.set_defaults(group=None, command=None)
|
||||||
CLIConfig.contribute_args(main)
|
CLIConfig.contribute_to_argparse(main)
|
||||||
sub = main.add_subparsers(metavar='COMMAND')
|
sub = main.add_subparsers(metavar='COMMAND')
|
||||||
start = sub.add_parser(
|
start = sub.add_parser(
|
||||||
'start',
|
'start',
|
||||||
|
@ -193,7 +193,7 @@ def get_argument_parser():
|
||||||
'should selectively be applied.')
|
'should selectively be applied.')
|
||||||
)
|
)
|
||||||
start.set_defaults(command='start', start_parser=start)
|
start.set_defaults(command='start', start_parser=start)
|
||||||
Config.contribute_args(start)
|
Config.contribute_to_argparse(start)
|
||||||
|
|
||||||
api = Daemon.get_api_definitions()
|
api = Daemon.get_api_definitions()
|
||||||
groups = {}
|
groups = {}
|
||||||
|
|
|
@ -766,7 +766,6 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
[--download_timeout=<download_timeout>]
|
[--download_timeout=<download_timeout>]
|
||||||
[--peer_port=<peer_port>]
|
[--peer_port=<peer_port>]
|
||||||
[--max_key_fee=<max_key_fee>]
|
[--max_key_fee=<max_key_fee>]
|
||||||
[--disable_max_key_fee=<disable_max_key_fee>]
|
|
||||||
[--use_upnp=<use_upnp>]
|
[--use_upnp=<use_upnp>]
|
||||||
[--run_reflector_server=<run_reflector_server>]
|
[--run_reflector_server=<run_reflector_server>]
|
||||||
[--cache_time=<cache_time>]
|
[--cache_time=<cache_time>]
|
||||||
|
@ -787,9 +786,9 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
'currency': <currency_symbol>,
|
'currency': <currency_symbol>,
|
||||||
'amount': <amount>
|
'amount': <amount>
|
||||||
}.
|
}.
|
||||||
In the CLI, it must be an escaped JSON string
|
In the CLI, it must be: '<amount> <currency>'
|
||||||
Supported currency symbols: LBC, USD, BTC
|
Supported currency symbols: LBC, USD, BTC
|
||||||
--disable_max_key_fee=<disable_max_key_fee> : (bool) False
|
--no_max_key_fee : (bool) Disable max key fee.
|
||||||
--use_upnp=<use_upnp> : (bool) True
|
--use_upnp=<use_upnp> : (bool) True
|
||||||
--run_reflector_server=<run_reflector_server> : (bool) False
|
--run_reflector_server=<run_reflector_server> : (bool) False
|
||||||
--cache_time=<cache_time> : (int) 150
|
--cache_time=<cache_time> : (int) 150
|
||||||
|
|
|
@ -196,6 +196,10 @@ class ConfigurationTests(unittest.TestCase):
|
||||||
c.max_key_fee = {'currency': 'BTC', 'amount': 1}
|
c.max_key_fee = {'currency': 'BTC', 'amount': 1}
|
||||||
with open(config, 'r') as fd:
|
with open(config, 'r') as fd:
|
||||||
self.assertEqual(fd.read(), 'max_key_fee:\n amount: 1\n currency: BTC\n')
|
self.assertEqual(fd.read(), 'max_key_fee:\n amount: 1\n currency: BTC\n')
|
||||||
|
with c.update_config():
|
||||||
|
c.max_key_fee = None
|
||||||
|
with open(config, 'r') as fd:
|
||||||
|
self.assertEqual(fd.read(), 'max_key_fee: null\n')
|
||||||
|
|
||||||
def test_max_key_fee_from_args(self):
|
def test_max_key_fee_from_args(self):
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
Loading…
Reference in a new issue