Simplify secret request UX (#102)

* Simplify secret UX

* Update doc

* Fix tests
This commit is contained in:
Jason O'Donnell 2020-08-11 10:06:28 -04:00 committed by GitHub
parent 633de935e7
commit f7f0d5a289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 109 additions and 220 deletions

View file

@ -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,