Files: c0a64989f4157a9fd83067b87859a94b12675f90 / 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