http: autogen rpc creds.

This commit is contained in:
Christopher Jeffrey 2016-07-26 18:14:14 -07:00
parent 91a1477aeb
commit bea7bc4677
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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);
};