Skip to content

Commit 1c77960

Browse files
committed
refactor: support Pinning.RemoteServices["name"]
This adds fallback to new notation from ipfs/kubo#8096 We default to old one because new one matters only when '.' is present in service name
1 parent 88d8e5a commit 1c77960

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bundles/pinning.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ const mfsPolicyEnableFlag = memoize(async (serviceName, ipfs) => {
2323
try {
2424
return await ipfs.config.get(`Pinning.RemoteServices.${serviceName}.Policies.MFS.Enable`)
2525
} catch (e) {
26-
console.error(`unexpected config.get error for "${serviceName}"`, e)
27-
return false
26+
if (e.message?.includes('Pinning.RemoteServices key has no attributes')) {
27+
try { // retry with notation from https://github.com/ipfs/go-ipfs/pull/8096
28+
return await ipfs.config.get(`Pinning.RemoteServices["${serviceName}"].Policies.MFS.Enable`)
29+
} catch (_) {}
30+
}
31+
console.error(`unexpected config.get error for "${serviceName}": ${e.message}`)
2832
}
33+
return false
2934
}, { maxAge: 3000 })
3035

3136
const uniqueCidBatches = (arrayOfCids, size) => {

0 commit comments

Comments
 (0)