Skip to content

Commit

Permalink
feat(mv3): 🔀 Adding migrations for embedded to external.
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Arora <[email protected]>
  • Loading branch information
whizzzkid committed Sep 15, 2023
1 parent ec2da96 commit 5748c15
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions add-on/src/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import isFQDN from 'is-fqdn'
import { isIPv4, isIPv6 } from 'is-ip'
import { POSSIBLE_NODE_TYPES } from './state.js'

/**
* @type {Readonly<import('../types/companion.js').CompanionOptions>}
Expand Down Expand Up @@ -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)
}

0 comments on commit 5748c15

Please sign in to comment.