1
0

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:
SomberNight
2026-01-19 11:30:53 +00:00
parent 99e173e504
commit 21248817c9
2 changed files with 2 additions and 1 deletions

View File

@@ -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")

View File

@@ -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