mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-04-12 23:20:08 +00:00
Simplify secret request UX (#102)
* Simplify secret UX * Update doc * Fix tests
This commit is contained in:
parent
633de935e7
commit
f7f0d5a289
8 changed files with 109 additions and 220 deletions
|
|
@ -25,9 +25,9 @@ async function getSecrets(secretRequests, client) {
|
|||
const responseCache = new Map();
|
||||
const results = [];
|
||||
for (const secretRequest of secretRequests) {
|
||||
const { path, selector } = secretRequest;
|
||||
let { path, selector } = secretRequest;
|
||||
|
||||
const requestPath = `v1${path}`;
|
||||
const requestPath = `v1/${path}`;
|
||||
let body;
|
||||
let cachedResponse = false;
|
||||
if (responseCache.has(requestPath)) {
|
||||
|
|
@ -39,7 +39,13 @@ async function getSecrets(secretRequests, client) {
|
|||
responseCache.set(requestPath, body);
|
||||
}
|
||||
|
||||
const value = selectData(JSON.parse(body), selector);
|
||||
selector = "data." + selector
|
||||
body = JSON.parse(body)
|
||||
if (body.data["data"] != undefined) {
|
||||
selector = "data." + selector
|
||||
}
|
||||
|
||||
const value = selectData(body, selector);
|
||||
results.push({
|
||||
request: secretRequest,
|
||||
value,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue