git ssb

16+

Dominic / patchbay



Commit 9c46fa792313eae0c2a42a1c99894cc71567d11c

better config

mixmix committed on 11/11/2018, 10:47:32 PM
Parent: 8beaa8d9c8e1fe17f0b1ee4190029fae0b937a35

Files changed

config.jschanged
config.jsView
@@ -4,11 +4,9 @@
44 const Path = require('path')
55 const merge = require('lodash/merge')
66
77 const appName = process.env.ssb_appname || 'ssb'
8-const opts = appName === 'ssb'
9- ? null
10- : null // require('./default-config.json')
8 +const opts = appName === 'ssb' ? null : null
119
1210 exports.gives = nest('config.sync.load')
1311 exports.create = (api) => {
1412 var config
@@ -17,25 +15,31 @@
1715
1816 console.log('LOADING config')
1917 config = Config(appName, opts)
2018 config.keys = ssbKeys.loadOrCreateSync(Path.join(config.path, 'secret'))
21- config.remote = buildRemote(config)
2219
23- if (process.platform !== 'win32') {
24- config = merge(config, {
25- connections: {
26- incoming: { unix: [{ 'scope': 'local', 'transform': 'noauth' }] }
27- }
28- })
29- }
20 + config = merge(
21 + config,
22 + Connections(config),
23 + Remote(config)
24 + )
3025
3126 return config
3227 })
3328 }
3429
35-function buildRemote (config) {
30 +function Connections (config) {
31 + const connections = (process.platform === 'win32')
32 + ? undefined // this seems wrong?
33 + : { incoming: { unix: [{ 'scope': 'local', 'transform': 'noauth' }] } }
34 +
35 + return connections ? { connections } : {}
36 +}
37 +
38 +function Remote (config) {
3639 const pubkey = config.keys.id.slice(1).replace(`.${config.keys.curve}`, '')
40 + const remote = (process.platform === 'win32')
41 + ? undefined // `net:127.0.0.1:${config.port}~shs:${pubkey}` // currently broken
42 + : `unix:${Path.join(config.path, 'socket')}:~noauth:${pubkey}`
3743
38- return process.platform !== 'win32'
39- ? `net:127.0.0.1:${config.port}~shs:${pubkey}`
40- : `unix:${Path.join(config.path, 'socket')}:~noauth:${pubkey}`
44 + return remote ? { remote } : {}
4145 }

Built with git-ssb-web