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

24 lines
592 B
JavaScript

const { lookpath } = require('lookpath');
const spawnPromise = require('./spawn-promise');
const cliPath = async () => await lookpath('boundary');
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) => {
const command = [
'connect',
`-target-id=${target_id}`,
`-token=${token}`,
`-addr=${addr}`,
'-format=json',
'--output-json-errors'
]
return spawnPromise(command);
}
}