tadded --help option and option to choose path to config file - electrum-personal-server - Maximally lightweight electrum server for a single user HTML git clone https://git.parazyd.org/electrum-personal-server DIR Log DIR Files DIR Refs DIR README --- DIR commit e5f868ad5e8a2feea63ffcf97ea24ad4c00fa514 DIR parent c0865a51a0b2d0b2b239d2c2fe402b9f8802e7f0 HTML Author: chris-belcher <chris-belcher@users.noreply.github.com> Date: Fri, 30 Mar 2018 13:19:08 +0100 added --help option and option to choose path to config file Diffstat: M README.md | 2 -- M server.py | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) --- DIR diff --git a/README.md b/README.md t@@ -97,8 +97,6 @@ When trying this, make sure you report any crashes, odd behaviour, transactions appearing as `Not Verified` or times when Electrum disconnects (which indicates the server behaved unexpectedly). -Someone should try running this on a Raspberry PI. - #### Caveat about pruning Electrum Personal Server is fully compatible with pruning, except for one thing. DIR diff --git a/server.py b/server.py t@@ -2,7 +2,7 @@ import socket, time, json, datetime, struct, binascii, ssl, os.path, platform from configparser import ConfigParser, NoSectionError, NoOptionError -import traceback +import traceback, sys from electrumpersonalserver.jsonrpc import JsonRpc, JsonRpcError import electrumpersonalserver.hashes as hashes t@@ -397,9 +397,14 @@ def obtain_rpc_username_password(datadir): def main(): global debug_fd + if len(sys.argv) == 2 and sys.argv[1] == "--help": + print("Usage: ./server.py <path/to/config.cfg>\nRunning without arg" + + " defaults to `config.cfg`") + return try: + configfile = sys.argv[1] if len(sys.argv) == 2 else "config.cfg" config = ConfigParser() - config.read(["config.cfg"]) + config.read(configfile) config.options("master-public-keys") except NoSectionError: log("Non-existant configuration file `config.cfg`")