Files: 956c7764209ab27bc37b8e7a9d929db326d24ce5 / server.js
750 bytesRaw
1 | |
2 | ':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@" |
3 | // http://unix.stackexchange.com/questions/65235/universal-node-js-shebang |
4 | // vi: ft=javascript |
5 | |
6 | var appName = process.env.ssb_appname || |
7 | require('child_process').spawnSync('git', ['config', 'ssb.appname'], |
8 | {encoding: 'utf8'}).stdout.trim() |
9 | var ssbConfig = require('ssb-config/inject')(appName) |
10 | var ssbClient = require('ssb-client') |
11 | var keys = require('ssb-keys') |
12 | .loadOrCreateSync(require('path').join(ssbConfig.path, 'secret')) |
13 | |
14 | require('.')(process.argv[3], function (err, server) { |
15 | require('ssb-reconnect')(function (cb) { |
16 | ssbClient(keys, ssbConfig, cb) |
17 | }, function (err, ssb, reconnect) { |
18 | if (err) throw err |
19 | server.setSSB(ssb, reconnect) |
20 | }) |
21 | }) |
22 |
Built with git-ssb-web