Files: 1e9994726f2118a824d6e041144b60cc1643fac0 / config / inject.js
1845 bytesRaw
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 | console.log('Using the ' + name + ' config') |
12 | |
13 | var network |
14 | |
15 | if (name === 'ssb') { |
16 | network = { |
17 | port: 8008, |
18 | ws: { |
19 | port: 8989 |
20 | }, |
21 | caps: { |
22 | shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=', |
23 | sign: null |
24 | } |
25 | } |
26 | } |
27 | |
28 | if (name === 'decent') { |
29 | network = { |
30 | port: 3333, |
31 | ws: { |
32 | port: 3939 |
33 | }, |
34 | caps: { |
35 | shs: 'EVRctE2Iv8GrO/BpQCF34e2FMPsDJot9x0j846LjVtc=', |
36 | sign: null |
37 | } |
38 | } |
39 | } |
40 | |
41 | if (name === 'testnet') { |
42 | network = { |
43 | port: 9999, |
44 | ws: { |
45 | port: 9191 |
46 | }, |
47 | caps: { |
48 | shs: 'sR74I0+OW6LBYraQQ2YtFtqV5Ns77Tv5DyMfyWbrlpI=', |
49 | sign: null |
50 | } |
51 | } |
52 | } |
53 | |
54 | var HOME = home() || 'browser' //most probably browser |
55 | |
56 | return RC(name, merge(network, { |
57 | name: name, |
58 | //standard stuff that probably doesn't need to change below |
59 | host: nonPrivate.v4 || '', |
60 | timeout: 0, |
61 | allowPrivate: true, |
62 | pub: true, |
63 | local: true, |
64 | friends: { |
65 | dunbar: 150, |
66 | hops: 3 |
67 | }, |
68 | gossip: { |
69 | connections: 3 |
70 | }, |
71 | connections: { |
72 | incoming: { |
73 | net: [{ port: 8008, scope: "public", transform: "shs" }], |
74 | ws: [{ scope: "public", transform: "shs" }] |
75 | }, |
76 | outgoing: { |
77 | net: [{ transform: "shs" }], |
78 | ws: [{ transform: "shs" }] |
79 | } |
80 | }, |
81 | path: path.join(HOME, '.' + name), |
82 | timers: { |
83 | connection: 0, |
84 | reconnect: 5*SEC, |
85 | ping: 5*MIN, |
86 | handshake: 5*SEC |
87 | }, |
88 | master: [], |
89 | party: true //disable quotas |
90 | }, override || {})) |
91 | } |
92 |
Built with git-ssb-web