Files: a712df77a26a0ced340c16b0f754794049f19fe2 / backup / async / importIdentity.js
683 bytesRaw
1 | const nest = require('depnest') |
2 | const { onceTrue } = require('mutant') |
3 | const path = require('path') |
4 | const fs = require('fs') |
5 | const os = require('os') |
6 | const config = require('../../config').create().config.sync.load() |
7 | const peersFile = path.join(config.path, "gossip.json") |
8 | const secretFile = path.join(config.path, "secret") |
9 | |
10 | // TODO: files should take into account env vars |
11 | |
12 | exports.gives = nest('backup.async.importIdentity') |
13 | |
14 | exports.create = function (api) { |
15 | return nest('backup.async.importIdentity', (importData, cb) => { |
16 | |
17 | fs.writeFileSync(peersFile, JSON.stringify(importData.peers), "utf8") |
18 | fs.writeFileSync(secretFile, importData.secret, "utf8") |
19 | |
20 | cb() |
21 | |
22 | }) |
23 | } |
24 |
Built with git-ssb-web