mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-09 16:16:55 +00:00
Use normalizeOutputKey in action.js
This commit is contained in:
parent
696678826f
commit
c557ed0663
1 changed files with 2 additions and 14 deletions
|
|
@ -3,24 +3,12 @@ const core = require('@actions/core');
|
||||||
const command = require('@actions/core/lib/command');
|
const command = require('@actions/core/lib/command');
|
||||||
const got = require('got').default;
|
const got = require('got').default;
|
||||||
const jsonata = require('jsonata');
|
const jsonata = require('jsonata');
|
||||||
|
const { normalizeOutputKey } = require('./utils');
|
||||||
|
|
||||||
module.exports = {};
|
module.exports = {};
|
||||||
const wildcard = '*';
|
const wildcard = '*';
|
||||||
module.exports.wildcard = wildcard;
|
module.exports.wildcard = wildcard;
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 = normalizeOutputKey;
|
|
||||||
|
|
||||||
const { auth: { retrieveToken }, secrets: { getSecrets } } = require('./index');
|
const { auth: { retrieveToken }, secrets: { getSecrets } } = require('./index');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue