5
0
Fork 0
mirror of https://github.com/hashicorp/vault-action.git synced 2025-11-09 16:16:55 +00:00

Support POST to get secret for Kubernetes.

This commit is contained in:
János Kukoda 2022-09-22 19:36:42 +02:00
parent 7d98524254
commit 7ec3aeab19

View file

@ -22,6 +22,11 @@ const jsonata = require("jsonata");
* @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 = [];
for (const secretRequest of secretRequests) {
@ -35,7 +40,12 @@ async function getSecrets(secretRequests, client) {
cachedResponse = true;
} else {
try {
const result = await client.get(requestPath);
let result;
if (bodyReq) {
result = await client.post(requestPath, bodyReq);
} else {
result = await client.get(requestPath);
}
body = result.body;
responseCache.set(requestPath, body);
} catch (error) {