diff --git a/bin.js b/bin.js index 085f5ffe..0bb22a62 100755 --- a/bin.js +++ b/bin.js @@ -22,7 +22,12 @@ var i = argv.indexOf('--') var conf = argv.slice(i+1) argv = ~i ? argv.slice(0, i) : argv -var config = require('ssb-config/inject')(process.env.ssb_appname, minimist(conf)) +var config = require('ssb-config/inject')( + process.env.ssb_appname, + Object.assign( + minimist(conf), + { host: process.env.ssb_host } + )) var keys = ssbKeys.loadOrCreateSync(path.join(config.path, 'secret')) if(keys.curve === 'k256') diff --git a/index.js b/index.js index 9fd66bcc..beca6542 100644 --- a/index.js +++ b/index.js @@ -166,6 +166,7 @@ function createSbot() { //this is just the default app key. //it can be overridden by passing a appKey as option //when creating a Sbot instance. + host: process.env.ssb_host, appKey: require('./lib/ssb-cap') }) .use(SSB) diff --git a/plugins/local.js b/plugins/local.js index c6da8fae..4e7c39a3 100644 --- a/plugins/local.js +++ b/plugins/local.js @@ -34,7 +34,7 @@ module.exports = { } } - var local = broadcast(config.port) + var local = broadcast(config.port, config.loopback, config.family) var addrs = {} var lastSeen = {} @@ -54,6 +54,7 @@ module.exports = { var data = buf.toString() var peer = ref.parseAddress(data) if (peer && peer.key !== sbot.id) { + if (config.family === 'IPv6') peer.host = buf.address addrs[peer.key] = peer lastSeen[peer.key] = Date.now() sbot.gossip.add(data, 'local')