mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-04-16 08:45:44 +00:00
Add exportConfigEnv option
This setting this will export `VAULT_ADDR`, `VAULT_SKIP_VERIFY`, and `VAULT_NAMESPACE` when set in the action's configuration.
This commit is contained in:
parent
7d98524254
commit
9c41d44553
5 changed files with 59 additions and 0 deletions
|
|
@ -109,6 +109,23 @@ describe('integration', () => {
|
|||
|
||||
expect(core.exportVariable).toBeCalledWith('OTHERSECRET', 'OTHERCUSTOMSECRET_IN_NAMESPACE');
|
||||
});
|
||||
|
||||
it('export Vault config env', async () => {
|
||||
mockExportConfigEnv("true");
|
||||
await exportSecrets();
|
||||
|
||||
expect(core.exportVariable).toBeCalledTimes(3);
|
||||
expect(core.exportVariable).toBeCalledWith('VAULT_ADDR', vaultUrl);
|
||||
expect(core.exportVariable).toBeCalledWith('VAULT_SKIP_VERIFY', 'false');
|
||||
expect(core.exportVariable).toBeCalledWith('VAULT_NAMESPACE', vaultNamespace);
|
||||
});
|
||||
|
||||
it('not export Vault config env', async () => {
|
||||
mockExportConfigEnv("false");
|
||||
await exportSecrets();
|
||||
|
||||
expect(core.exportVariable).toBeCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('authenticate with approle', () => {
|
||||
|
|
@ -289,3 +306,9 @@ function mockInput(secrets) {
|
|||
.calledWith('secrets', expect.anything())
|
||||
.mockReturnValueOnce(secrets);
|
||||
}
|
||||
|
||||
function mockExportConfigEnv(doExport) {
|
||||
when(core.getInput)
|
||||
.calledWith('exportConfEnv', expect.anything())
|
||||
.mockReturnValueOnce(doExport);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue