From bea7bc46771497ca4047c365ec1366def1980c71 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 26 Jul 2016 18:14:14 -0700 Subject: [PATCH] http: autogen rpc creds. --- lib/bcoin/http/server.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/bcoin/http/server.js b/lib/bcoin/http/server.js index 5147e141..9cdab070 100644 --- a/lib/bcoin/http/server.js +++ b/lib/bcoin/http/server.js @@ -53,6 +53,12 @@ function HTTPServer(options) { this.rpcPassword = options.rpcPassword; this.rpc = null; + if (!this.rpcUser) + this.rpcUser = 'admin'; + + if (!this.rpcPassword) + this.rpcPassword = bcoin.ec.random(20).toString('hex'); + if (this.apiKey) { if (typeof this.apiKey === 'string') { assert(utils.isHex(this.apiKey), 'API key must be a hex string.'); @@ -1011,6 +1017,7 @@ HTTPServer.prototype._initIO = function _initIO() { */ HTTPServer.prototype.open = function open(callback) { + this.logger.info('RPC credentials: %s:%s', this.rpcUser, this.rpcPassword); this.server.open(callback); };