Files
threshold-ui/ui/desktop/electron-app/src/boundary-cli.js
T

23 lines
600 B
JavaScript
Raw Normal View History

const path = require('path');
2020-12-10 16:41:26 -05:00
const spawnPromise = require('./spawn-promise');
const cliPath = async () => path.resolve(__dirname, 'binary', 'boundary');
2020-12-10 16:41:26 -05:00
module.exports = {
// Find boundary cli path
path: () => cliPath(),
// Check boundary cli existence
exists: () => Boolean(cliPath()),
// Initiate connection and return output
connect: (target_id, token, addr) => {
2020-12-10 16:41:26 -05:00
const command = [
'connect',
`-target-id=${target_id}`,
`-token=${token}`,
`-addr=${addr}`,
2020-12-10 16:41:26 -05:00
'-format=json',
'--output-json-errors'
];
2020-12-10 16:41:26 -05:00
return spawnPromise(command);
}
}