Files: b31526ef6669313066c14beea488d5c2154c069c / config.js
851 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 = process.env.ssb_appname || 'ticktack' //'ticktack' TEMP: this is for the windowsSSB installer only |
7 | const appName = 'ssb' |
8 | const opts = appName == 'ssb' |
9 | ? null |
10 | : require('./default-config.json') |
11 | |
12 | exports.gives = nest('config.sync.load') |
13 | exports.create = (api) => { |
14 | var config |
15 | return nest('config.sync.load', () => { |
16 | if (!config) { |
17 | config = Config(appName, opts) |
18 | config.keys = ssbKeys.loadOrCreateSync(Path.join(config.path, 'secret')) |
19 | |
20 | // HACK: fix offline on windows by specifying 127.0.0.1 instead of localhost (default) |
21 | config.remote = `net:127.0.0.1:${config.port}~shs:${config.keys.id.slice(1).replace('.ed25519', '')}` |
22 | } |
23 | return config |
24 | }) |
25 | } |
26 |
Built with git-ssb-web