Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
fix(config): use only api server
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshyx committed Sep 27, 2016
1 parent 02ad2ee commit 76df551
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
21 changes: 6 additions & 15 deletions src/IpfsConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class IpfsConnector extends EventEmitter {
*/
return this.emit(events.SERVICE_STARTED);
}
if(data.includes('API server')){
this.options.apiAddress = data.toString().trim().split(' ').pop();
}
});
this._callbacks.set('ipfs.init', (err: Error, stdout: string, stderr: string) => {
if (err) {
Expand Down Expand Up @@ -181,20 +184,7 @@ export class IpfsConnector extends EventEmitter {
*/
return this.emit(events.SERVICE_FAILED);
}
childProcess.exec(`${this.downloadManager.wrapper.path()} config Addresses.API`,
{ env: options.extra.env },
(error, apiAddress, stderr) => {
if (error) {
this.logger.error(error);
}
if (stderr.includes('ipfs init')) {
this._init();
return Promise.delay(3000).then(() => this.start());
}
options.apiAddress = apiAddress.trim();
return this._start();
});

return this._start();
}
);
}
Expand Down Expand Up @@ -309,9 +299,10 @@ export class IpfsConnector extends EventEmitter {
}

if (ports.hasOwnProperty('api')) {
this.options.apiAddress = `/ip4/127.0.0.1/tcp/${ports.api}`;
setup.push(
this.api.apiClient
.config.set('Addresses.API', `/ip4/127.0.0.1/tcp/${ports.api}`)
.config.set('Addresses.API', this.options.apiAddress)
);
}

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"node_modules",
"dist",
"typings/main",
"typings/main.d.ts"
"typings/main.d.ts",
"coverage"
]
}

0 comments on commit 76df551

Please sign in to comment.