config: allow setting "forgetconfig" option in file, not just on CLI
- by specifying "default=<VALUE>" in commands.py, <VALUE> would always overwrite what is in the config file
- note `$ ./run_electrum -o setconfig forget_config true` still does not work,
as that first sets forget_config in memory, and then - by virtue of the setting -
it refuses to write changes to the config file
- hence this option would have to be set manually by editing the json
(or as a CLI flag, as before)
ref https://github.com/spesmilo/electrum/pull/10421#issuecomment-3765862081
This commit is contained in:
@@ -2397,7 +2397,7 @@ def add_global_options(parser, suppress=False):
|
||||
"--rpcpassword", dest=SimpleConfig.RPC_PASSWORD.key(), default=argparse.SUPPRESS,
|
||||
help=argparse.SUPPRESS if suppress else "RPC password")
|
||||
group.add_argument(
|
||||
"--forgetconfig", action="store_true", dest=SimpleConfig.CONFIG_FORGET_CHANGES.key(), default=False,
|
||||
"--forgetconfig", action="store_true", dest=SimpleConfig.CONFIG_FORGET_CHANGES.key(), default=None,
|
||||
help=argparse.SUPPRESS if suppress else "Forget config on exit")
|
||||
|
||||
|
||||
|
||||
@@ -446,6 +446,7 @@ class SimpleConfig(Logger):
|
||||
|
||||
def save_user_config(self):
|
||||
if self.CONFIG_FORGET_CHANGES:
|
||||
self.logger.warning(f"not saving config changes to disk as {self.cv.CONFIG_FORGET_CHANGES.key()} is set", only_once=True)
|
||||
return
|
||||
if not self.path:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user