Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Expose API and better handling of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
victorb committed Aug 31, 2017
1 parent ec643b3 commit e6302eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ COPY . /usr/src/app
ENV IPFS_WRTC_LINUX_WINDOWS=1
ENV IPFS_BOOTSTRAP=1
ENV IPFS_MONITORING=1
ENV IPFS_PATH=/root/.jsipfs

EXPOSE 4002
EXPOSE 4003
EXPOSE 5002
EXPOSE 9090

CMD ./init-and-daemon.sh
4 changes: 3 additions & 1 deletion init-and-daemon.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#! /bin/sh -e

node src/cli/bin.js init

sed -i.bak 's/127.0.0.1/0.0.0.0/g' $IPFS_PATH/config

node src/cli/bin.js daemon
5 changes: 4 additions & 1 deletion src/http-api/routes/debug.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const register = require('prom-client').register
const client = require('prom-client')
const boom = require('boom')

// Endpoint for handling debug metrics
module.exports = (server) => {
Expand All @@ -15,7 +16,9 @@ module.exports = (server) => {
.code(501) // 501 = Not Implemented
}
server.app.ipfs.swarm.peers((err, res) => {
if (err) throw err
if (err) {
return reply(err).code(500)
}
const count = res.length
gauge.set(count)
reply(register.metrics()).header('Content-Type', register.contentType)
Expand Down

0 comments on commit e6302eb

Please sign in to comment.