mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-09 08:06:55 +00:00
* Initial check-in of wildcard to get all secrets in path (Issue#234) * Fix wildcard for K/V v2 and Cubbyhole. Add more tests * Refactored out selectAndAppendResults * Use selectAndAppendResults for wildcard * Use normalizeOutputKey in action.js * Refactored wildcard --------- Co-authored-by: Scott Lemme <68233981+slemme1@users.noreply.github.com> Co-authored-by: Lemme <slemme@massmutual.com>
19 lines
444 B
JavaScript
19 lines
444 B
JavaScript
/**
|
|
* Replaces any dot chars to __ and removes non-ascii charts
|
|
* @param {string} dataKey
|
|
* @param {boolean=} isEnvVar
|
|
*/
|
|
function normalizeOutputKey(dataKey, isEnvVar = false) {
|
|
let outputKey = dataKey
|
|
.replace(".", "__")
|
|
.replace(new RegExp("-", "g"), "")
|
|
.replace(/[^\p{L}\p{N}_-]/gu, "");
|
|
if (isEnvVar) {
|
|
outputKey = outputKey.toUpperCase();
|
|
}
|
|
return outputKey;
|
|
}
|
|
|
|
module.exports = {
|
|
normalizeOutputKey
|
|
};
|