Files: f78c06b7b25151ef111ec0f608c6ce257e9db892 / config.js
819 bytesRaw
1 | const Config = require('ssb-config/inject') |
2 | const nest = require('depnest') |
3 | const ssbKeys = require('ssb-keys') |
4 | const Path = require('path') |
5 | |
6 | const appName = 'ssb' //'ticktack-ssb' |
7 | const opts = process.env.ssb_appname== 'ssb' ? {} :{ |
8 | port: 43750, |
9 | blobsPort: 43751, |
10 | ws: { |
11 | port: 43751 |
12 | } |
13 | } |
14 | |
15 | exports.gives = nest('config.sync.load') |
16 | exports.create = (api) => { |
17 | var config |
18 | return nest('config.sync.load', () => { |
19 | if (!config) { |
20 | config = Config(process.env.ssb_appname || appName, opts) |
21 | config.keys = ssbKeys.loadOrCreateSync(Path.join(config.path, 'secret')) |
22 | |
23 | // HACK: fix offline on windows by specifying 127.0.0.1 instead of localhost (default) |
24 | config.remote = `net:127.0.0.1:${config.port}~shs:${config.keys.id.slice(1).replace('.ed25519', '')}` |
25 | } |
26 | return config |
27 | }) |
28 | } |
29 |
Built with git-ssb-web