diff --git a/add-on/src/lib/options.js b/add-on/src/lib/options.js index 166b8191a..1bbbfca56 100644 --- a/add-on/src/lib/options.js +++ b/add-on/src/lib/options.js @@ -2,6 +2,7 @@ import isFQDN from 'is-fqdn' import { isIPv4, isIPv6 } from 'is-ip' +import { POSSIBLE_NODE_TYPES } from './state.js' /** * @type {Readonly} @@ -219,5 +220,14 @@ export async function migrateOptions (storage, debug) { } } + { + // -v3.0.0: migrate ipfsNodeType to 'external' (if missing) + const { ipfsNodeType } = await storage.get(['ipfsNodeType']) + if (!POSSIBLE_NODE_TYPES.includes(ipfsNodeType)) { + log('migrating ipfsNodeType to "external"') + await storage.set({ ipfsNodeType: 'external' }) + } + } + // TODO: refactor this, so migrations only run once (like https://github.com/sindresorhus/electron-store#migrations) }