From a3e0bd4403c762e2ad95bc87b3a79a66029e4880 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 19 Mar 2019 14:58:53 +0100 Subject: [PATCH 1/4] refactor: decouple HttpApi from cli/commands/daemon In the past API was exposed via HTTP Server only when jsipfs daemon was run from the commandline, so src/http/index.js was also responsible for orchestration that is not related to HTTP itself. This refactor moves code that is not related to HTTP Servers into standalone-daemon.js, which is easier to reason about, and unlocks use of HttpApi in contexts other than commandline jsipfs daemon, such as Firefox with libdweb or Chromium-based web browser with chrome.sockets APIs. Refs. https://github.com/ipfs-shipyard/ipfs-companion/issues/664 License: MIT Signed-off-by: Marcin Rataj --- .gitignore | 2 + src/cli/commands/daemon.js | 8 ++-- src/cli/standalone-daemon.js | 90 ++++++++++++++++++++++++++++++++++++ src/http/index.js | 51 ++------------------ 4 files changed, 100 insertions(+), 51 deletions(-) create mode 100644 src/cli/standalone-daemon.js diff --git a/.gitignore b/.gitignore index c548c9f1d6..d7223c6b87 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ docs # Logs logs *.log +# npm pack +*.tgz coverage diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 4f4b87e980..a274a30bb6 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -44,8 +44,8 @@ module.exports = { const repoPath = getRepoPath() // Required inline to reduce startup time - const HttpApi = require('../../http') - const api = new HttpApi({ + const StandaloneDaemon = require('../../cli/standalone-daemon') + const daemon = new StandaloneDaemon({ silent: argv.silent, repo: process.env.IPFS_PATH, offline: argv.offline, @@ -60,7 +60,7 @@ module.exports = { }) try { - await api.start() + await daemon.start() } catch (err) { if (err.code === 'ENOENT' && err.message.match(/uninitialized/i)) { print('Error: no initialized ipfs repo found in ' + repoPath) @@ -74,7 +74,7 @@ module.exports = { const cleanup = async () => { print(`Received interrupt signal, shutting down...`) - await api.stop() + await daemon.stop() process.exit(0) } diff --git a/src/cli/standalone-daemon.js b/src/cli/standalone-daemon.js new file mode 100644 index 0000000000..fde604241e --- /dev/null +++ b/src/cli/standalone-daemon.js @@ -0,0 +1,90 @@ +'use strict' + +const debug = require('debug') + +const IPFS = require('../core') +const HttpApi = require('../http') +const WStar = require('libp2p-webrtc-star') +const TCP = require('libp2p-tcp') +const MulticastDNS = require('libp2p-mdns') +const WS = require('libp2p-websockets') +const Bootstrap = require('libp2p-bootstrap') + +class StandaloneDaemon { + constructor (options) { + this._options = options || {} + this._log = debug('ipfs:daemon') + this._log.error = debug('ipfs:daemon:error') + + if (process.env.IPFS_MONITORING) { + // Setup debug metrics collection + const prometheusClient = require('prom-client') + const prometheusGcStats = require('prometheus-gc-stats') + const collectDefaultMetrics = prometheusClient.collectDefaultMetrics + collectDefaultMetrics({ timeout: 5000 }) + prometheusGcStats(prometheusClient.register)() + } + } + + async start () { + this._log('starting') + + const libp2p = { modules: {} } + + // Attempt to use any of the WebRTC versions available globally + let electronWebRTC + let wrtc + try { + electronWebRTC = require('electron-webrtc')() + } catch (err) { + this._log('failed to load optional electron-webrtc dependency') + } + try { + wrtc = require('wrtc') + } catch (err) { + this._log('failed to load optional webrtc dependency') + } + + if (wrtc || electronWebRTC) { + const using = wrtc ? 'wrtc' : 'electron-webrtc' + this._log(`Using ${using} for webrtc support`) + const wstar = new WStar({ wrtc: (wrtc || electronWebRTC) }) + libp2p.modules.transport = [TCP, WS, wstar] + libp2p.modules.peerDiscovery = [MulticastDNS, Bootstrap, wstar.discovery] + } + + // start the daemon + const ipfsOpts = Object.assign({ init: false }, this._options, { start: true, libp2p }) + const ipfs = new IPFS(ipfsOpts) + + await new Promise((resolve, reject) => { + ipfs.once('error', err => { + this._log('error starting core', err) + err.code = 'ENOENT' + reject(err) + }) + ipfs.once('start', resolve) + }) + + this._ipfs = ipfs + + // start HTTP servers (if API or Gateway is enabled in options) + const httpApi = new HttpApi(ipfs, ipfsOpts) + this._httpApi = await httpApi.start() + + this._log('started') + return this + } + + async stop () { + this._log('stopping') + await Promise.all([ + this._httpApi && this._httpApi.stop(), + this._ipfs && this._ipfs.stop() + ]) + this._log('stopped') + return this + } +} + +module.exports = StandaloneDaemon diff --git a/src/http/index.js b/src/http/index.js index 0091378353..69b305d43e 100644 --- a/src/http/index.js +++ b/src/http/index.js @@ -8,12 +8,6 @@ const promisify = require('promisify-es6') const toUri = require('multiaddr-to-uri') const toMultiaddr = require('uri-to-multiaddr') -const IPFS = require('../core') -const WStar = require('libp2p-webrtc-star') -const TCP = require('libp2p-tcp') -const MulticastDNS = require('libp2p-mdns') -const WS = require('libp2p-websockets') -const Bootstrap = require('libp2p-bootstrap') const errorHandler = require('./error-handler') const LOG = 'ipfs:http-api' const LOG_ERROR = 'ipfs:http-api:error' @@ -48,7 +42,8 @@ function serverCreator (serverAddrs, createServer, ipfs) { } class HttpApi { - constructor (options) { + constructor (ipfs, options) { + this._ipfs = ipfs this._options = options || {} this._log = debug(LOG) this._log.error = debug(LOG_ERROR) @@ -66,44 +61,7 @@ class HttpApi { async start () { this._log('starting') - const libp2p = { modules: {} } - - // Attempt to use any of the WebRTC versions available globally - let electronWebRTC - let wrtc - try { - electronWebRTC = require('electron-webrtc')() - } catch (err) { - this._log('failed to load optional electron-webrtc dependency') - } - try { - wrtc = require('wrtc') - } catch (err) { - this._log('failed to load optional webrtc dependency') - } - - if (wrtc || electronWebRTC) { - const using = wrtc ? 'wrtc' : 'electron-webrtc' - this._log(`Using ${using} for webrtc support`) - const wstar = new WStar({ wrtc: (wrtc || electronWebRTC) }) - libp2p.modules.transport = [TCP, WS, wstar] - libp2p.modules.peerDiscovery = [MulticastDNS, Bootstrap, wstar.discovery] - } - - // start the daemon - const ipfsOpts = Object.assign({ init: false }, this._options, { start: true, libp2p }) - const ipfs = new IPFS(ipfsOpts) - - await new Promise((resolve, reject) => { - ipfs.once('error', err => { - this._log('error starting core', err) - err.code = 'ENOENT' - reject(err) - }) - ipfs.once('start', resolve) - }) - - this._ipfs = ipfs + const ipfs = this._ipfs const config = await ipfs.config.get() config.Addresses = config.Addresses || {} @@ -208,8 +166,7 @@ class HttpApi { const stopServers = servers => Promise.all((servers || []).map(s => s.stop())) await Promise.all([ stopServers(this._apiServers), - stopServers(this._gatewayServers), - this._ipfs && this._ipfs.stop() + stopServers(this._gatewayServers) ]) this._log('stopped') return this From 0b9076dde2f008299487b4f3d5be4afc2efa1849 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 4 Apr 2019 23:16:50 +0200 Subject: [PATCH 2/4] fix: print HTTP listeners only when run as daemon This changes behavior in web browser. Instead of printing to console.log, it uses proper debug-based logger. Old behavior in terminal (when run via `jsipfs daemon`) does not change. License: MIT Signed-off-by: Marcin Rataj --- src/cli/standalone-daemon.js | 2 +- src/http/index.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cli/standalone-daemon.js b/src/cli/standalone-daemon.js index fde604241e..e4d9c5c541 100644 --- a/src/cli/standalone-daemon.js +++ b/src/cli/standalone-daemon.js @@ -69,7 +69,7 @@ class StandaloneDaemon { this._ipfs = ipfs // start HTTP servers (if API or Gateway is enabled in options) - const httpApi = new HttpApi(ipfs, ipfsOpts) + const httpApi = new HttpApi(ipfs, Object.assign({ announceListeners: true }, ipfsOpts)) this._httpApi = await httpApi.start() this._log('started') diff --git a/src/http/index.js b/src/http/index.js index 69b305d43e..330ed923bd 100644 --- a/src/http/index.js +++ b/src/http/index.js @@ -77,14 +77,15 @@ class HttpApi { const gatewayAddrs = config.Addresses.Gateway this._gatewayServers = await serverCreator(gatewayAddrs, this._createGatewayServer, ipfs) + const announce = this._options.announceListeners ? ipfs._print : this._log this._apiServers.forEach(apiServer => { - ipfs._print('API listening on %s', apiServer.info.ma) + announce('API listening on %s', apiServer.info.ma.toString()) }) this._gatewayServers.forEach(gatewayServer => { - ipfs._print('Gateway (read only) listening on %s', gatewayServer.info.ma) + announce('Gateway (read only) listening on %s', gatewayServer.info.ma.toString()) }) this._apiServers.forEach(apiServer => { - ipfs._print('Web UI available at %s', toUri(apiServer.info.ma) + '/webui') + announce('Web UI available at %s', toUri(apiServer.info.ma) + '/webui') }) this._log('started') return this From 7c32da899138a3d8acf024b56bbff95fab85064b Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 11 Apr 2019 20:04:40 +0200 Subject: [PATCH 3/4] test: use StandaloneDaemon in test/http-api,gateway This replaces durect use of HttpApi with StandaloneDaemon, restoring all existing tests to operational state. License: MIT Signed-off-by: Marcin Rataj --- test/gateway/index.js | 6 +++--- test/http-api/inject/bitswap.js | 2 +- test/http-api/inject/block.js | 2 +- test/http-api/inject/bootstrap.js | 2 +- test/http-api/inject/config.js | 2 +- test/http-api/inject/dag.js | 2 +- test/http-api/inject/dht.js | 2 +- test/http-api/inject/dns.js | 2 +- test/http-api/inject/files.js | 2 +- test/http-api/inject/id.js | 2 +- test/http-api/inject/name.js | 2 +- test/http-api/inject/object.js | 2 +- test/http-api/inject/pin.js | 2 +- test/http-api/inject/ping.js | 2 +- test/http-api/inject/pubsub.js | 2 +- test/http-api/inject/resolve.js | 2 +- test/http-api/inject/version.js | 2 +- test/http-api/routes.js | 4 ++-- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/gateway/index.js b/test/gateway/index.js index c5f9bd0be6..8ad692288d 100644 --- a/test/gateway/index.js +++ b/test/gateway/index.js @@ -5,7 +5,7 @@ const chai = require('chai') const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) -const API = require('../../src/http') +const StandaloneDaemon = require('../../src/cli/standalone-daemon') const loadFixture = require('aegir/fixtures') const os = require('os') const path = require('path') @@ -33,7 +33,7 @@ describe('HTTP Gateway', function () { this.timeout(60 * 1000) const repoPath = path.join(os.tmpdir(), '/ipfs-' + hat()) - http.api = new API({ + http.api = new StandaloneDaemon({ repo: repoPath, init: true, config: { @@ -60,7 +60,7 @@ describe('HTTP Gateway', function () { await http.api.start() - gateway = http.api._gatewayServers[0] + gateway = http.api._httpApi._gatewayServers[0] // QmbQD7EMEL1zeebwBsWEfA3ndgSS6F7S6iTuwuqasPgVRi await http.api._ipfs.add([ diff --git a/test/http-api/inject/bitswap.js b/test/http-api/inject/bitswap.js index 9ac273c947..303831884b 100644 --- a/test/http-api/inject/bitswap.js +++ b/test/http-api/inject/bitswap.js @@ -12,7 +12,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) before(async function () { diff --git a/test/http-api/inject/block.js b/test/http-api/inject/block.js index a121fc315d..e247dc9225 100644 --- a/test/http-api/inject/block.js +++ b/test/http-api/inject/block.js @@ -13,7 +13,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('/block/put', () => { diff --git a/test/http-api/inject/bootstrap.js b/test/http-api/inject/bootstrap.js index 5015b3d40f..5c791f2861 100644 --- a/test/http-api/inject/bootstrap.js +++ b/test/http-api/inject/bootstrap.js @@ -11,7 +11,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] return api.inject({ method: 'GET', url: '/api/v0/bootstrap/add/default' diff --git a/test/http-api/inject/config.js b/test/http-api/inject/config.js index 2388ed4264..f361037569 100644 --- a/test/http-api/inject/config.js +++ b/test/http-api/inject/config.js @@ -17,7 +17,7 @@ module.exports = (http) => { before(() => { updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8')) - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) after(() => { diff --git a/test/http-api/inject/dag.js b/test/http-api/inject/dag.js index 62eca02574..605cb076dd 100644 --- a/test/http-api/inject/dag.js +++ b/test/http-api/inject/dag.js @@ -33,7 +33,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('/dag/get', () => { diff --git a/test/http-api/inject/dht.js b/test/http-api/inject/dht.js index 04cb501227..455a4bb8b1 100644 --- a/test/http-api/inject/dht.js +++ b/test/http-api/inject/dht.js @@ -12,7 +12,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('/findpeer', () => { diff --git a/test/http-api/inject/dns.js b/test/http-api/inject/dns.js index 010797f57a..18f0ec5925 100644 --- a/test/http-api/inject/dns.js +++ b/test/http-api/inject/dns.js @@ -8,7 +8,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) it('resolve ipfs.io dns', async () => { diff --git a/test/http-api/inject/files.js b/test/http-api/inject/files.js index 8ff819dfce..aaf4f10dd5 100644 --- a/test/http-api/inject/files.js +++ b/test/http-api/inject/files.js @@ -13,7 +13,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('/add', () => { diff --git a/test/http-api/inject/id.js b/test/http-api/inject/id.js index ff8922f312..f3f7160375 100644 --- a/test/http-api/inject/id.js +++ b/test/http-api/inject/id.js @@ -8,7 +8,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) it('get the id', async () => { diff --git a/test/http-api/inject/name.js b/test/http-api/inject/name.js index 699ed0a07b..1e723c3749 100644 --- a/test/http-api/inject/name.js +++ b/test/http-api/inject/name.js @@ -16,7 +16,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) it('should publish a record', async function () { diff --git a/test/http-api/inject/object.js b/test/http-api/inject/object.js index 952cf1ab7d..662474e0b0 100644 --- a/test/http-api/inject/object.js +++ b/test/http-api/inject/object.js @@ -17,7 +17,7 @@ module.exports = (http) => { let api before('api', () => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('/new', () => { diff --git a/test/http-api/inject/pin.js b/test/http-api/inject/pin.js index db1ec00b6c..ceb11ae400 100644 --- a/test/http-api/inject/pin.js +++ b/test/http-api/inject/pin.js @@ -37,7 +37,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('rm', () => { diff --git a/test/http-api/inject/ping.js b/test/http-api/inject/ping.js index 3ed712c483..ef8cd3bee4 100644 --- a/test/http-api/inject/ping.js +++ b/test/http-api/inject/ping.js @@ -13,7 +13,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) it('returns 400 if both n and count are provided', async () => { diff --git a/test/http-api/inject/pubsub.js b/test/http-api/inject/pubsub.js index 3e88d40434..86cec4f078 100644 --- a/test/http-api/inject/pubsub.js +++ b/test/http-api/inject/pubsub.js @@ -16,7 +16,7 @@ module.exports = (http) => { const topicNotSubscribed = 'somethingRandom' before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) describe('/sub', () => { diff --git a/test/http-api/inject/resolve.js b/test/http-api/inject/resolve.js index 1d70206e8a..21baf6ba71 100644 --- a/test/http-api/inject/resolve.js +++ b/test/http-api/inject/resolve.js @@ -12,7 +12,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) it('should resolve a path and return a base2 encoded CID', async () => { diff --git a/test/http-api/inject/version.js b/test/http-api/inject/version.js index 9a83821ebe..d1cb6a1577 100644 --- a/test/http-api/inject/version.js +++ b/test/http-api/inject/version.js @@ -9,7 +9,7 @@ module.exports = (http) => { let api before(() => { - api = http.api._apiServers[0] + api = http.api._httpApi._apiServers[0] }) it('get the version', async () => { diff --git a/test/http-api/routes.js b/test/http-api/routes.js index 0fa6fdf7df..ed971d2928 100644 --- a/test/http-api/routes.js +++ b/test/http-api/routes.js @@ -6,7 +6,7 @@ const chai = require('chai') const dirtyChai = require('dirty-chai') chai.use(dirtyChai) const hat = require('hat') -const API = require('../../src/http/index') +const StandaloneDaemon = require('../../src/cli/standalone-daemon') const promisify = require('promisify-es6') const ncp = promisify(require('ncp').ncp) const path = require('path') @@ -22,7 +22,7 @@ describe('HTTP API', () => { let http = {} const startHttpAPI = async (config) => { - http.api = new API({ + http.api = new StandaloneDaemon({ repo: repoTests, pass: hat(), config, From 1e821029b75d5e5847cdd26007631e0bc6861477 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 12 Apr 2019 12:10:53 +0200 Subject: [PATCH 4/4] refactor: rename StandaloneDaemon to Daemon License: MIT Signed-off-by: Marcin Rataj --- src/cli/commands/daemon.js | 14 ++++++++++++-- src/cli/{standalone-daemon.js => daemon.js} | 12 +++++++++--- src/http/index.js | 17 ----------------- test/gateway/index.js | 4 ++-- test/http-api/routes.js | 4 ++-- 5 files changed, 25 insertions(+), 26 deletions(-) rename src/cli/{standalone-daemon.js => daemon.js} (88%) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index a274a30bb6..570cd56a86 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -1,6 +1,7 @@ 'use strict' const os = require('os') +const toUri = require('multiaddr-to-uri') const { getRepoPath, print, ipfsPathHelp } = require('../utils') module.exports = { @@ -44,8 +45,8 @@ module.exports = { const repoPath = getRepoPath() // Required inline to reduce startup time - const StandaloneDaemon = require('../../cli/standalone-daemon') - const daemon = new StandaloneDaemon({ + const Daemon = require('../../cli/daemon') + const daemon = new Daemon({ silent: argv.silent, repo: process.env.IPFS_PATH, offline: argv.offline, @@ -61,6 +62,15 @@ module.exports = { try { await daemon.start() + daemon._httpApi._apiServers.forEach(apiServer => { + print(`API listening on ${apiServer.info.ma.toString()}`) + }) + daemon._httpApi._gatewayServers.forEach(gatewayServer => { + print(`Gateway (read only) listening on ${gatewayServer.info.ma.toString()}`) + }) + daemon._httpApi._apiServers.forEach(apiServer => { + print(`Web UI available at ${toUri(apiServer.info.ma)}/webui`) + }) } catch (err) { if (err.code === 'ENOENT' && err.message.match(/uninitialized/i)) { print('Error: no initialized ipfs repo found in ' + repoPath) diff --git a/src/cli/standalone-daemon.js b/src/cli/daemon.js similarity index 88% rename from src/cli/standalone-daemon.js rename to src/cli/daemon.js index e4d9c5c541..879432018b 100644 --- a/src/cli/standalone-daemon.js +++ b/src/cli/daemon.js @@ -9,8 +9,9 @@ const TCP = require('libp2p-tcp') const MulticastDNS = require('libp2p-mdns') const WS = require('libp2p-websockets') const Bootstrap = require('libp2p-bootstrap') +const promisify = require('promisify-es6') -class StandaloneDaemon { +class Daemon { constructor (options) { this._options = options || {} this._log = debug('ipfs:daemon') @@ -69,9 +70,14 @@ class StandaloneDaemon { this._ipfs = ipfs // start HTTP servers (if API or Gateway is enabled in options) - const httpApi = new HttpApi(ipfs, Object.assign({ announceListeners: true }, ipfsOpts)) + const httpApi = new HttpApi(ipfs, ipfsOpts) this._httpApi = await httpApi.start() + // for the CLI to know the where abouts of the API + if (this._httpApi._apiServers.length) { + await promisify(ipfs._repo.apiAddr.set)(this._httpApi._apiServers[0].info.ma) + } + this._log('started') return this } @@ -87,4 +93,4 @@ class StandaloneDaemon { } } -module.exports = StandaloneDaemon +module.exports = Daemon diff --git a/src/http/index.js b/src/http/index.js index 330ed923bd..b46448ef8a 100644 --- a/src/http/index.js +++ b/src/http/index.js @@ -4,8 +4,6 @@ const Hapi = require('hapi') const Pino = require('hapi-pino') const debug = require('debug') const multiaddr = require('multiaddr') -const promisify = require('promisify-es6') -const toUri = require('multiaddr-to-uri') const toMultiaddr = require('uri-to-multiaddr') const errorHandler = require('./error-handler') @@ -69,24 +67,9 @@ class HttpApi { const apiAddrs = config.Addresses.API this._apiServers = await serverCreator(apiAddrs, this._createApiServer, ipfs) - // for the CLI to know the where abouts of the API - if (this._apiServers.length) { - await promisify(ipfs._repo.apiAddr.set)(this._apiServers[0].info.ma) - } - const gatewayAddrs = config.Addresses.Gateway this._gatewayServers = await serverCreator(gatewayAddrs, this._createGatewayServer, ipfs) - const announce = this._options.announceListeners ? ipfs._print : this._log - this._apiServers.forEach(apiServer => { - announce('API listening on %s', apiServer.info.ma.toString()) - }) - this._gatewayServers.forEach(gatewayServer => { - announce('Gateway (read only) listening on %s', gatewayServer.info.ma.toString()) - }) - this._apiServers.forEach(apiServer => { - announce('Web UI available at %s', toUri(apiServer.info.ma) + '/webui') - }) this._log('started') return this } diff --git a/test/gateway/index.js b/test/gateway/index.js index 8ad692288d..f8836700fb 100644 --- a/test/gateway/index.js +++ b/test/gateway/index.js @@ -5,7 +5,7 @@ const chai = require('chai') const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) -const StandaloneDaemon = require('../../src/cli/standalone-daemon') +const Daemon = require('../../src/cli/daemon') const loadFixture = require('aegir/fixtures') const os = require('os') const path = require('path') @@ -33,7 +33,7 @@ describe('HTTP Gateway', function () { this.timeout(60 * 1000) const repoPath = path.join(os.tmpdir(), '/ipfs-' + hat()) - http.api = new StandaloneDaemon({ + http.api = new Daemon({ repo: repoPath, init: true, config: { diff --git a/test/http-api/routes.js b/test/http-api/routes.js index ed971d2928..d79572dc18 100644 --- a/test/http-api/routes.js +++ b/test/http-api/routes.js @@ -6,7 +6,7 @@ const chai = require('chai') const dirtyChai = require('dirty-chai') chai.use(dirtyChai) const hat = require('hat') -const StandaloneDaemon = require('../../src/cli/standalone-daemon') +const Daemon = require('../../src/cli/daemon') const promisify = require('promisify-es6') const ncp = promisify(require('ncp').ncp) const path = require('path') @@ -22,7 +22,7 @@ describe('HTTP API', () => { let http = {} const startHttpAPI = async (config) => { - http.api = new StandaloneDaemon({ + http.api = new Daemon({ repo: repoTests, pass: hat(), config,