git ssb

2+

ev / minsbot



Commit fa73006e36dea91f38d49312b44f87bcb421bd08

move config in-house

Ev Bogue committed on 2/13/2019, 1:36:50 AM
Parent: b8ff6fb46136a9a34fe3c3c6dd957cd1eb36a267

Files changed

bin.jschanged
config/index.jsadded
config/inject.jsadded
bin.jsView
@@ -21,19 +21,22 @@
2121 var i = argv.indexOf('--')
2222 var conf = argv.slice(i+1)
2323 argv = ~i ? argv.slice(0, i) : argv
2424
25-var config = require('ssb-config/inject')(process.env.ssb_appname, minimist(conf))
25 +var network = 'ssb'
26 +//var network = 'decent'
27 +//var network = 'testnet'
2628
29 +var config = require('./config/inject')(network)
30 +
2731 var keys = ssbKeys.loadOrCreateSync(path.join(config.path, 'secret'))
2832 if(keys.curve === 'k256')
2933 throw new Error('k256 curves are no longer supported,'+
3034 'please delete' + path.join(config.path, 'secret'))
3135
3236 var manifestFile = path.join(config.path, 'manifest.json')
3337
3438 if (argv[0] == 'server') {
35- console.log(packageJson.name, packageJson.version, config.path, 'logging.level:'+config.logging.level)
3639 console.log('my key ID:', keys.public)
3740
3841 // special server command:
3942 // import sbot and start the server
@@ -86,10 +89,8 @@
8689
8790 // write RPC manifest to ~/.ssb/manifest.json
8891 fs.writeFileSync(manifestFile, JSON.stringify(server.getManifest(), null, 2))
8992
90- if(process.stdout.isTTY && (config.logging.level != 'info'))
91- ProgressBar(server.progress)
9293 } else {
9394
9495 // normal command:
9596 // create a client connection to the server
config/index.jsView
@@ -1,0 +1,1 @@
1 +module.exports = require('./inject')()
config/inject.jsView
@@ -1,0 +1,82 @@
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 + //host: '192.168.1.3',
61 + timeout: 0,
62 + allowPrivate: true,
63 + pub: true,
64 + local: true,
65 + friends: {
66 + dunbar: 150,
67 + hops: 3
68 + },
69 + gossip: {
70 + connections: 3
71 + },
72 + path: path.join(HOME, '.' + name),
73 + timers: {
74 + connection: 0,
75 + reconnect: 5*SEC,
76 + ping: 5*MIN,
77 + handshake: 5*SEC
78 + },
79 + master: [],
80 + party: true //disable quotas
81 + }, override || {}))
82 +}

Built with git-ssb-web