mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-09 16:16:55 +00:00
Add postPayload
This commit is contained in:
parent
7ec3aeab19
commit
19a3799291
3 changed files with 10 additions and 10 deletions
|
|
@ -39,6 +39,9 @@ inputs:
|
|||
authPayload:
|
||||
description: 'The JSON payload to be sent to Vault when using a custom authentication method.'
|
||||
required: false
|
||||
postPayload:
|
||||
description: 'The JSON payload to be sent to Vault over a POST request, enabled POST instead of GET.'
|
||||
required: false
|
||||
extraHeaders:
|
||||
description: 'A string of newline separated extra headers to include on every request.'
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ async function exportSecrets() {
|
|||
|
||||
const vaultMethod = (core.getInput('method', { required: false }) || 'token').toLowerCase();
|
||||
const authPayload = core.getInput('authPayload', { required: false });
|
||||
const postPayload = core.getInput('postPayload', { required: false });
|
||||
|
||||
if (!AUTH_METHODS.includes(vaultMethod) && !authPayload) {
|
||||
throw Error(`Sorry, the provided authentication method ${vaultMethod} is not currently supported and no custom authPayload was provided.`);
|
||||
}
|
||||
|
|
@ -79,7 +81,7 @@ async function exportSecrets() {
|
|||
return request;
|
||||
});
|
||||
|
||||
const results = await getSecrets(requests, client);
|
||||
const results = await getSecrets(requests, client, postPayload);
|
||||
|
||||
for (const result of results) {
|
||||
const { value, request, cachedResponse } = result;
|
||||
|
|
|
|||
|
|
@ -21,11 +21,6 @@ const jsonata = require("jsonata");
|
|||
* @param {import('got').Got} client
|
||||
* @return {Promise<SecretResponse<TRequest>[]>}
|
||||
*/
|
||||
async function getSecrets(secretRequests, client) {
|
||||
getSecrets(secretRequests, client, undefined);
|
||||
}
|
||||
|
||||
|
||||
async function getSecrets(secretRequests, client, body) {
|
||||
const responseCache = new Map();
|
||||
const results = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue