Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function spawnEphemeralNode (callback) {
ipfsd.disposable((err, node) => {
if (err) {
return callback(err)
}
// Note: we have to set each config value
// independently since the config/replace endpoint
// doesn't work as expected
series([
(cb) => {
const configValues = {
Bootstrap: [],
Discovery: {},
'API.HTTPHeaders.Access-Control-Allow-Origin': ['*'],
// This is not needed after all
// 'API.HTTPHeaders.Access-Control-Allow-Credentials': true,
'API.HTTPHeaders.Access-Control-Allow-Methods': [
(cb) => {
if (this.disposable) {
const config = Object.assign({ init: this.init }, this.config)
ctl.disposable(config, cb)
} else if (this.init) {
ctl.local(this.path, (err, node) => {
if (err) {
return cb(err)
}
node.init((err) => cb(err, node))
})
} else {
ctl.local(this.path, cb)
}
},
(node, cb) => {
function startIndependentNode (nodes, key, cb) {
ipfsd.disposable((err, node) => {
if (err) {
return cb(err)
}
nodes[key] = node
console.log(' ipfs init done - (bootstrap and mdns off) - ' + key)
const configValues = {
Bootstrap: [],
Discovery: {},
'API.HTTPHeaders.Access-Control-Allow-Origin': ['*'],
'API.HTTPHeaders.Access-Control-Allow-Credentials': 'true',
'API.HTTPHeaders.Access-Control-Allow-Methods': ['PUT', 'POST', 'GET']
}