Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
/ Orion Public archive

Commit

Permalink
Merge pull request #99 from Siderus/bugfix/119-storage-list-connects-…
Browse files Browse the repository at this point in the history
…forever

Save IPFS_CLIENT correctly
  • Loading branch information
koalalorenzo authored May 7, 2018
2 parents ee559b5 + 67a7ab3 commit 84fb829
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export function ensureDaemonConfigured () {

// Change the configuration
conf.Addresses.API = global.IPFS_MULTIADDR_API
conf.Addresses.Gateway = global.IPFS_MULTIADDR_GATEAY
conf.Addresses.Gateway = global.IPFS_MULTIADDR_GATEWAY
conf.Addresses.Swarm = global.IPFS_MULTIADDR_SWARM

// Return a promise that writes the configuration back in the file
Expand Down Expand Up @@ -281,7 +281,9 @@ export function promiseRepoUnlocked (timeout = 30) {
return getApiMultiAddress().then(() => {
clearInterval(iID)
return resolve()
}).catch((err) => { console.log('error:', err) }) // do nothing in case of errors
}).catch(() => {
console.log('Waiting for repo to be unlocked...')
})
}, 1000) // every second
})
}
9 changes: 4 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ global.IPFS_CLIENT = null
// Sets default values for IPFS configurations
global.IPFS_BINARY_PATH = `${rootDir.get()}/go-ipfs/ipfs`
global.IPFS_MULTIADDR_API = '/ip4/127.0.0.1/tcp/5001'
global.IPFS_MULTIADDR_GATEAY = '/ip4/127.0.0.1/tcp/8080'
global.IPFS_MULTIADDR_GATEWAY = '/ip4/127.0.0.1/tcp/8080'
global.IPFS_MULTIADDR_SWARM = ['/ip4/0.0.0.0/tcp/4001', '/ip6/::/tcp/4001']

// Used to point to the right IPFS repo & conf
Expand Down Expand Up @@ -113,7 +113,7 @@ app.on('ready', () => {
// Use our own daemon, but on different ports
console.log('Using custom setup for Orion new IPFS node (localhost:5101)')
global.IPFS_MULTIADDR_API = '/ip4/127.0.0.1/tcp/5101'
global.IPFS_MULTIADDR_GATEAY = '/ip4/127.0.0.1/tcp/8180'
global.IPFS_MULTIADDR_GATEWAY = '/ip4/127.0.0.1/tcp/8180'
global.IPFS_MULTIADDR_SWARM = ['/ip4/0.0.0.0/tcp/4101', '/ip6/::/tcp/4101']
}
}
Expand All @@ -123,10 +123,9 @@ app.on('ready', () => {
// Logs the path and configuration used
console.log('IPFS_BINARY_PATH', global.IPFS_BINARY_PATH)
console.log('IPFS_MULTIADDR_API', global.IPFS_MULTIADDR_API)
console.log('IPFS_MULTIADDR_GATEAY', global.IPFS_MULTIADDR_GATEAY)
console.log('IPFS_MULTIADDR_GATEWAY', global.IPFS_MULTIADDR_GATEWAY)
console.log('IPFS_MULTIADDR_SWARM', global.IPFS_MULTIADDR_SWARM)
console.log('IPFS_REPO_PATH', global.IPFS_REPO_PATH)
console.log('IPFS_MULTIADDR_API', global.IPFS_MULTIADDR_API)
return Promise.resolve(shouldStart)
})
// Configure & Start the daemon in case
Expand Down Expand Up @@ -163,7 +162,7 @@ app.on('ready', () => {
})
.then(promiseRepoUnlocked) // ensures that the api are ready
// Start the IPFS API Client
.then(initIPFSClient())
.then(initIPFSClient)
.then(client => {
console.log('Connecting to the IPFS Daemon')
global.IPFS_CLIENT = client
Expand Down

0 comments on commit 84fb829

Please sign in to comment.