From 00bca77bab7d5f07668128ce2f94b968797a8339 Mon Sep 17 00:00:00 2001 From: Richard Simpson Date: Sun, 24 Nov 2019 15:17:48 -0600 Subject: [PATCH] tweak naming --- action.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/action.js b/action.js index 144a696..5b136cf 100644 --- a/action.js +++ b/action.js @@ -12,15 +12,16 @@ async function exportSecrets() { for (const secret of secrets) { const { secretPath, outputName, secretKey } = secret; - var headers = { + const requestOptions = { headers: { 'X-Vault-Token': vaultToken }}; + if (vaultNamespace != null){ - headers.headers["X-Vault-Namespace"] = vaultNamespace + requestOptions.headers["X-Vault-Namespace"] = vaultNamespace } - const result = await got(`${vaultUrl}/v1/secret/data/${secretPath}`, headers); + const result = await got(`${vaultUrl}/v1/secret/data/${secretPath}`, requestOptions); const parsedResponse = JSON.parse(result.body); const vaultKeyData = parsedResponse.data; @@ -96,4 +97,4 @@ module.exports = { exportSecrets, parseSecretsInput, normalizeOutputKey -}; \ No newline at end of file +};