diff --git a/lbrynet/conf.py b/lbrynet/conf.py index 744bec931..eef403fd0 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -159,10 +159,11 @@ class Path(String): class MaxKeyFee(Setting[dict]): def validate(self, value): - assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \ - f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"." - if value["currency"] not in CURRENCIES: - raise InvalidCurrencyError(value["currency"]) + if value is not None: + assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \ + f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"." + if value["currency"] not in CURRENCIES: + raise InvalidCurrencyError(value["currency"]) @staticmethod def _parse_list(l): diff --git a/lbrynet/extras/cli.py b/lbrynet/extras/cli.py index dce3f818c..9205910dd 100644 --- a/lbrynet/extras/cli.py +++ b/lbrynet/extras/cli.py @@ -176,7 +176,7 @@ def get_argument_parser(): help='Show lbrynet CLI version and exit.' ) main.set_defaults(group=None, command=None) - CLIConfig.contribute_args(main) + CLIConfig.contribute_to_argparse(main) sub = main.add_subparsers(metavar='COMMAND') start = sub.add_parser( 'start', @@ -193,7 +193,7 @@ def get_argument_parser(): 'should selectively be applied.') ) start.set_defaults(command='start', start_parser=start) - Config.contribute_args(start) + Config.contribute_to_argparse(start) api = Daemon.get_api_definitions() groups = {} diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 0d9051569..910f65899 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -766,7 +766,6 @@ class Daemon(metaclass=JSONRPCServerType): [--download_timeout=] [--peer_port=] [--max_key_fee=] - [--disable_max_key_fee=] [--use_upnp=] [--run_reflector_server=] [--cache_time=] @@ -787,9 +786,9 @@ class Daemon(metaclass=JSONRPCServerType): 'currency': , 'amount': }. - In the CLI, it must be an escaped JSON string + In the CLI, it must be: ' ' Supported currency symbols: LBC, USD, BTC - --disable_max_key_fee= : (bool) False + --no_max_key_fee : (bool) Disable max key fee. --use_upnp= : (bool) True --run_reflector_server= : (bool) False --cache_time= : (int) 150 diff --git a/tests/unit/test_conf.py b/tests/unit/test_conf.py index ff750fb11..ba0cb1fec 100644 --- a/tests/unit/test_conf.py +++ b/tests/unit/test_conf.py @@ -196,6 +196,10 @@ class ConfigurationTests(unittest.TestCase): c.max_key_fee = {'currency': 'BTC', 'amount': 1} with open(config, 'r') as fd: 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): parser = argparse.ArgumentParser()