From 25f0192fd6f902d714a75b23ca5ab083290b9511 Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Wed, 17 Jul 2013 18:40:02 +0200 Subject: [PATCH] Also set RPC port default from namecoin.conf Also use the found rpcport in namecoin.conf to initialise the RPC port setting at first if it is not yet set. --- src/namecoin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/namecoin.py b/src/namecoin.py index 5ad1c049..02f80639 100644 --- a/src/namecoin.py +++ b/src/namecoin.py @@ -240,11 +240,10 @@ def ensureNamecoinOptions (): shared.config.set (configSection, "namecoinrpctype", "namecoind") if not shared.config.has_option (configSection, "namecoinrpchost"): shared.config.set (configSection, "namecoinrpchost", "localhost") - if not shared.config.has_option (configSection, "namecoinrpcport"): - shared.config.set (configSection, "namecoinrpcport", "8336") hasUser = shared.config.has_option (configSection, "namecoinrpcuser") hasPass = shared.config.has_option (configSection, "namecoinrpcpassword") + hasPort = shared.config.has_option (configSection, "namecoinrpcport") # Try to read user/password from .namecoin configuration file. try: @@ -269,6 +268,7 @@ def ensureNamecoinOptions (): "namecoinrpcpassword", val) if key == "rpcport": shared.namecoinDefaultRpcPort = val + # Will be set in config below anyway. nmc.close () @@ -278,3 +278,8 @@ def ensureNamecoinOptions (): shared.config.set (configSection, "namecoinrpcuser", "") if (not hasPass): shared.config.set (configSection, "namecoinrpcpassword", "") + + # Set default port now, possibly to found value. + if (not hasPort): + shared.config.set (configSection, "namecoinrpcport", + shared.namecoinDefaultRpcPort)