Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: add --enable-preload to enable/disable preloading for daemons (
Browse files Browse the repository at this point in the history
…#1909)

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
Alan Shaw authored Mar 6, 2019
1 parent 3fff46a commit 9470900
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module.exports = {
type: 'boolean',
default: false
})
.option('enable-preload', {
type: 'boolean',
default: true
})
},

handler (argv) {
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/core/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 9470900

Please sign in to comment.