Files: 4e7982f745d702f29aca19ba8c0f9eb788c82493 / config.js
863 bytesRaw
1 | const nest = require('depnest') |
2 | const Config = require('ssb-config/inject') |
3 | const ssbKeys = require('ssb-keys') |
4 | const Path = require('path') |
5 | |
6 | const appName = process.env.ssb_appname || 'ssb' |
7 | const opts = appName === 'ssb' |
8 | ? null |
9 | : null // require('./default-config.json') |
10 | |
11 | exports.gives = nest('config.sync.load') |
12 | exports.create = (api) => { |
13 | var config |
14 | return nest('config.sync.load', () => { |
15 | if (!config) { |
16 | console.log('LOADING config') |
17 | config = Config(appName, opts) |
18 | config.keys = ssbKeys.loadOrCreateSync(Path.join(config.path, 'secret')) |
19 | |
20 | if (!config.connections.incoming.unix) |
21 | config.connections.incoming.unix = [{ "scope": "local", "transform": "noauth" }] |
22 | |
23 | config.remote = `unix:${Path.join(config.path, 'socket')}:~noauth:${config.keys.id.slice(1).replace('.ed25519', '')}` |
24 | } |
25 | return config |
26 | }) |
27 | } |
28 |
Built with git-ssb-web