* [COMPLIANCE] Add Copyright and License Headers * chore: 🤖 update Copyright headers to satisfy our lint rules --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
39 lines
900 B
JavaScript
39 lines
900 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
/* eslint-disable no-undef */
|
|
const { execSync } = require('child_process');
|
|
|
|
/**
|
|
* Checks that the boundary cli is available
|
|
*/
|
|
exports.checkBoundaryCli = async () => {
|
|
try {
|
|
execSync('which boundary');
|
|
} catch (e) {
|
|
throw new Error('boundary does not exist on the path');
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Uses the boundary CLI to authenticate to the specified Boundary instance
|
|
*/
|
|
exports.authenticateBoundaryCli = async () => {
|
|
try {
|
|
execSync(
|
|
'boundary authenticate password' +
|
|
' -addr=' +
|
|
process.env.BOUNDARY_ADDR +
|
|
' -auth-method-id=' +
|
|
process.env.E2E_PASSWORD_AUTH_METHOD_ID +
|
|
' -login-name=' +
|
|
process.env.E2E_PASSWORD_ADMIN_LOGIN_NAME +
|
|
' -password=env://E2E_PASSWORD_ADMIN_PASSWORD'
|
|
);
|
|
} catch (e) {
|
|
console.log(`${e.stderr}`);
|
|
}
|
|
};
|