mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-05-15 04:50:33 +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>
This commit is contained in:
parent
cb841f2c86
commit
d9197ec2d2
8 changed files with 343 additions and 68 deletions
19
src/utils.js
Normal file
19
src/utils.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* 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
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue