From a19a6b86944ec08c61d53c1fb3afa1be3ebf1ec7 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 23 Apr 2020 08:55:07 +0100 Subject: [PATCH] fix: ipfs daemon flags License: MIT Signed-off-by: Henrique Dias --- src/common/store.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/common/store.js b/src/common/store.js index a5b7ffb6f..4eef4cb7c 100644 --- a/src/common/store.js +++ b/src/common/store.js @@ -3,20 +3,32 @@ const Store = require('electron-store') const store = new Store() -if (store.get('version') !== 5) { +const defaultFlags = [ + '--migrate', + '--enable-gc', + '--routing', 'dhtclient' +] + +if (store.get('version', 0) < 5) { store.clear() // default config store.set('ipfsConfig', { type: 'go', path: '', - flags: ['--migrate=true', '--routing=dhtclient', '--enable-gc=true'], + flags: defaultFlags, keysize: 2048 }) store.set('version', 5) } +const flags = store.get('ipfsConfig.flags', []) + +if (flags.includes('--migrate=true') || flags.includes('--enable-gc=true')) { + store.set('ipfsConfig.flags', defaultFlags) +} + if (!store.get('language')) { store.set('language', (electron.app || electron.remote.app).getLocale()) }