git ssb

30+

cel / git-ssb-web



Tree: be2435e2d8c0a0f95bf72eecaf890175bb4caff2

Files: be2435e2d8c0a0f95bf72eecaf890175bb4caff2 / server.js

830 bytesRaw
1#!/bin/sh
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
6var appName = 'ssb_appname' in process.env ? process.env.ssb_appname :
7 require('child_process').spawnSync('git', ['config', 'ssb.appname'],
8 {encoding: 'utf8'}).stdout.trim()
9var config = require('ssb-config/inject')(appName)
10var ssbClient = require('ssb-client')
11var keys = require('ssb-keys')
12 .loadOrCreateSync(require('path').join(config.path, 'secret'))
13
14var opts = config
15opts.listenAddr = opts._[1]
16opts.appname = appName
17
18require('.')(opts, function (err, server) {
19 require('ssb-reconnect')(function (cb) {
20 ssbClient(keys, config, cb)
21 }, function (err, ssb, reconnect) {
22 if (err) throw err
23 server.setSSB(ssb, reconnect)
24 })
25})
26

Built with git-ssb-web