diff --git a/contrib/nodejs-bwt-daemon/index.js b/contrib/nodejs-bwt-daemon/index.js index 43ca509..5bab630 100644 --- a/contrib/nodejs-bwt-daemon/index.js +++ b/contrib/nodejs-bwt-daemon/index.js @@ -22,7 +22,7 @@ function start_bwt(options, progress_cb, done) { , progress_cb_ffi = ffi.Callback('void', [ 'string', 'float', 'uint32', 'string' ], progress_cb) , shutdown_ptrptr = ref.alloc(shutdownPtrPtr) - debug('starting with %O', options); + debug('starting with %O', { ...options, bitcoind_auth: '**SCRUBBED**' }); libbwt.bwt_start.async(opt_json, progress_cb_ffi, shutdown_ptrptr, function(err, code) { if (err) return done(err) if (code != OK) return done(new Error(`bwt failed with code ${code}`)) diff --git a/src/app.rs b/src/app.rs index c7d5111..a61132a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -34,7 +34,7 @@ pub struct App { impl App { pub fn boot(config: Config, progress_tx: Option>) -> Result { - debug!("{:?}", config); + debug!("{}", scrub_config(&config)); let watcher = WalletWatcher::from_config(&config)?; @@ -166,12 +166,6 @@ impl App { Some(self.http.as_ref()?.addr()) } - pub fn test_rpc(config: &Config) -> Result<()> { - let rpc = RpcClient::new(config.bitcoind_url(), config.bitcoind_auth()?)?; - rpc.get_wallet_info()?; - Ok(()) - } - // Pipe the shutdown receiver `rx` to trigger `sync_tx`. This is needed to start the next // sync loop run immediately, which will then process the shutdown signal itself. Without // this, the shutdown signal will only be noticed after a delay. @@ -209,6 +203,12 @@ impl App { fn default_shutdown_signal(&self) -> Option> { None } + + pub fn test_rpc(config: &Config) -> Result<()> { + let rpc = RpcClient::new(config.bitcoind_url(), config.bitcoind_auth()?)?; + rpc.get_wallet_info()?; + Ok(()) + } } // Load the specified wallet, ignore "wallet is already loaded" errors @@ -243,3 +243,11 @@ fn wait_bitcoind(rpc: &RpcClient, progress_tx: Option>) - Ok(()) } + +fn scrub_config(config: &Config) -> String { + let mut s = format!("{:?}", config); + if let Some(auth) = config.bitcoind_auth.as_deref() { + s = s.replace(auth, "**SCRUBBED**") + } + s +}