Skip to content

Commit

Permalink
fix: only replace when has previous flags
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Apr 23, 2020
1 parent 0ee2ac0 commit 1b0e0b6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/common/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@ const Store = require('electron-store')

const store = new Store()

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

if (store.get('version', 0) !== 6) {
store.set('ipfsConfig.flags', [
'--migrate',
'--enable-gc',
'--routing', 'dhtclient'
])
const flags = store.set('ipfsConfig.flags', [])

store.set('version', 6)
if (flags.includes('--migrate=true') || flags.includes('--enable-gc=true')) {
store.set('ipfsConfig.flags', defaultFlags)
}

if (!store.get('language')) {
Expand Down

0 comments on commit 1b0e0b6

Please sign in to comment.