From 94709006618cf36d9b29a9b82a1a5107b15d5558 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 6 Mar 2019 11:34:17 +0000 Subject: [PATCH] feat: add `--enable-preload` to enable/disable preloading for daemons (#1909) License: MIT Signed-off-by: Alan Shaw --- src/cli/commands/daemon.js | 5 +++++ src/core/preload.js | 1 + 2 files changed, 6 insertions(+) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index ba8dbd642a..0377f92b96 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -26,6 +26,10 @@ module.exports = { type: 'boolean', default: false }) + .option('enable-preload', { + type: 'boolean', + default: true + }) }, handler (argv) { @@ -41,6 +45,7 @@ module.exports = { repo: process.env.IPFS_PATH, offline: argv.offline, pass: argv.pass, + preload: { enabled: argv.enablePreload }, EXPERIMENTAL: { pubsub: argv.enablePubsubExperiment, ipnsPubsub: argv.enableNamesysPubsub, diff --git a/src/core/preload.js b/src/core/preload.js index 2902005fc2..e139d31790 100644 --- a/src/core/preload.js +++ b/src/core/preload.js @@ -18,6 +18,7 @@ module.exports = self => { options.addresses = options.addresses || [] if (!options.enabled || !options.addresses.length) { + log('preload disabled') const api = (_, callback) => { if (callback) { setImmediate(() => callback())