git ssb

16+

Dominic / patchbay



Tree: 557f4b880701243b85fff447aa30939faf97a997

Files: 557f4b880701243b85fff447aa30939faf97a997 / config.js

977 bytesRaw
1const nest = require('depnest')
2const Config = require('ssb-config/inject')
3const ssbKeys = require('ssb-keys')
4const Path = require('path')
5
6const appName = process.env.ssb_appname || 'ssb'
7const opts = appName === 'ssb'
8 ? null
9 : null // require('./default-config.json')
10
11exports.gives = nest('config.sync.load')
12exports.create = (api) => {
13 var config
14 return nest('config.sync.load', () => {
15 if (!config) {
16 console.log('LOADING config')
17 config = Config(appName, opts)
18
19 const keys = ssbKeys.loadOrCreateSync(Path.join(config.path, 'secret'))
20 const pubkey = keys.id.slice(1).replace(`.${keys.curve}`, '')
21
22 config.key = keys
23 if (!process.platform.startsWith('win')) {
24 config.connections = {
25 incoming: {
26 unix: [{ 'scope': 'local', 'transform': 'noauth' }]
27 }
28 }
29 config.remote = `unix:${Path.join(config.path, 'socket')}:~noauth:${pubkey}`
30 }
31 }
32 return config
33 })
34}
35

Built with git-ssb-web