git ssb

16+

Dominic / patchbay



Commit 14955bd14de37455c5c7c93c09692bb20eab43cb

fix windows config with a patch

mixmix committed on 1/24/2019, 4:17:32 AM
Parent: 5fe0e8a6f94d635713a10e68c26fa7ab8d857f80

Files changed

config.jschanged
config.jsView
@@ -2,42 +2,44 @@
22 const Config = require('ssb-config/inject')
33 const Path = require('path')
44 const merge = require('lodash/merge')
55
6-const appName = process.env.ssb_appname || 'ssb'
7-const opts = appName === 'ssb' ? null : null
8-
96 exports.gives = nest('config.sync.load')
107 exports.create = (api) => {
118 var config
129 return nest('config.sync.load', () => {
1310 if (config) return config
1411
1512 console.log('LOADING config')
16- config = Config(appName, opts)
13 + config = Config(process.env.ssb_appname || 'ssb')
1714
18- config = merge(
19- config,
20- Connections(config),
21- Remote(config)
22- )
15 + config = addSockets(config)
16 + config = fixLocalhost(config)
2317
2418 return config
2519 })
2620 }
2721
28-function Connections (config) {
29- const connections = (process.platform === 'win32')
30- ? undefined
31- : { incoming: { unix: [{ scope: 'local', transform: 'noauth', server: true }] } }
22 +function addSockets (config) {
23 + if (process.platform === 'win32') return config
3224
33- return connections ? { connections } : {}
25 + const pubkey = config.keys.id.slice(1).replace(`.${config.keys.curve}`, '')
26 + return merge(
27 + config,
28 + {
29 + connections: {
30 + incoming: { unix: [{ scope: 'local', transform: 'noauth', server: true }] }
31 + },
32 + remote: `unix:${Path.join(config.path, 'socket')}:~noauth:${pubkey}` // overwrites
33 + }
34 + )
3435 }
3536
36-function Remote (config) {
37- const pubkey = config.keys.id.slice(1).replace(`.${config.keys.curve}`, '')
38- const remote = (process.platform === 'win32')
39- ? undefined // `net:127.0.0.1:${config.port}~shs:${pubkey}` // currently broken
40- : `unix:${Path.join(config.path, 'socket')}:~noauth:${pubkey}`
37 +function fixLocalhost (config) {
38 + if (process.platform !== 'win32') return config
4139
42- return remote ? { remote } : {}
40 + // without this host defaults to :: which doesn't work on windows 10?
41 + config.connections.incoming.net[0].host = '127.0.0.1'
42 + config.connections.incoming.ws[0].host = '127.0.0.1'
43 + config.host = '127.0.0.1'
44 + return config
4345 }

Built with git-ssb-web