git ssb

2+

ev / mvd



Commit e3552ee1c934a68d659bfc5e61b86579de7fe17f

include multiple network configs

Ev Bogue committed on 4/28/2018, 5:14:16 PM
Parent: bf370f6569846a556d1d80c4bb1c11d2e4aa1287

Files changed

bin.jschanged
package-lock.jsonchanged
package.jsonchanged
config/index.jsadded
config/inject.jsadded
bin.jsView
@@ -5,40 +5,14 @@
55 var open = require('opn')
66 var home = require('os-homedir')()
77 var nonPrivate = require('non-private-ip')
88 var muxrpcli = require('muxrpcli')
9 +var yargs = require('yargs')
910
1011 var SEC = 1e3
1112 var MIN = 60*SEC
1213
13-var config = {
14- name: 'ssb',
15- host: nonPrivate.v4 || '',
16- timeout: 0,
17- local: 'true',
18- port: 8008,
19- path: path.join(home, '.ssb'),
20- ws: { port: 8989 },
21- caps: {
22- shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=',
23- sign: null
24- },
25- friends: {
26- dunbar: 150,
27- hops: 3
28- },
29- gossip: {
30- connections: 3
31- },
32- timers: {
33- connection: 0,
34- reconnect: 5*SEC,
35- ping: 5*MIN,
36- handshake: 5*SEC
37- },
38- master: [],
39- party: true
40-}
14 +var config = require('./config/inject')(yargs.appname || 'decent')
4115
4216 config.keys = ssbKeys.loadOrCreateSync(path.join(config.path, 'secret'))
4317
4418 var coraClient = fs.readFileSync(path.join('./build/index.html'))
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 216329 bytes
New file size: 216329 bytes
package.jsonView
@@ -38,7 +38,8 @@
3838 "ssb-markdown": "^3.6.0",
3939 "ssb-ooo": "^1.0.9",
4040 "ssb-query": "^2.0.1",
4141 "ssb-ref": "^2.9.1",
42- "visualize-buffer": "0.0.1"
42 + "visualize-buffer": "0.0.1",
43 + "yargs": "^11.0.0"
4344 }
4445 }
config/index.jsView
@@ -1,0 +1,1 @@
1 +module.exports = require('./inject')()
config/inject.jsView
@@ -1,0 +1,83 @@
1 +var path = require('path')
2 +var home = require('os-homedir')
3 +var nonPrivate = require('non-private-ip')
4 +var merge = require('deep-extend')
5 +var id = require('ssb-keys')
6 +var RC = require('rc')
7 +var SEC = 1e3
8 +var MIN = 60*SEC
9 +
10 +module.exports = function (name, override) {
11 + if(name == null)
12 + name = 'decent'
13 +
14 + console.log('Using the ' + name + ' config')
15 +
16 + var network
17 +
18 + if (name === 'ssb') {
19 + network = {
20 + port: 8008,
21 + ws: {
22 + port: 8989
23 + },
24 + caps: {
25 + shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=',
26 + sign: null
27 + }
28 + }
29 + }
30 +
31 + if (name === 'decent') {
32 + network = {
33 + port: 3333,
34 + ws: {
35 + port: 3939
36 + },
37 + caps: {
38 + shs: 'EVRctE2Iv8GrO/BpQCF34e2FMPsDJot9x0j846LjVtc=',
39 + sign: null
40 + }
41 + }
42 + }
43 +
44 + if (name === 'testnet') {
45 + network = {
46 + port: 9999,
47 + ws: {
48 + port: 9191
49 + },
50 + caps: {
51 + shs: 'sR74I0+OW6LBYraQQ2YtFtqV5Ns77Tv5DyMfyWbrlpI=',
52 + sign: null
53 + }
54 + }
55 + }
56 +
57 + var HOME = home() || 'browser' //most probably browser
58 +
59 + return RC(name, merge(network, {
60 + name: name,
61 + //standard stuff that probably doesn't need to change below
62 + host: nonPrivate.v4 || '',
63 + timeout: 0,
64 + pub: true,
65 + local: true,
66 + friends: {
67 + dunbar: 150,
68 + hops: 3
69 + },
70 + gossip: {
71 + connections: 3
72 + },
73 + path: path.join(HOME, '.' + name),
74 + timers: {
75 + connection: 0,
76 + reconnect: 5*SEC,
77 + ping: 5*MIN,
78 + handshake: 5*SEC
79 + },
80 + master: [],
81 + party: true //disable quotas
82 + }, override || {}))
83 +}

Built with git-ssb-web