Add TLS and mTLS support
This commit is contained in:
@@ -29,7 +29,28 @@ async function exportSecrets() {
|
||||
|
||||
const defaultOptions = {
|
||||
prefixUrl: vaultUrl,
|
||||
headers: {}
|
||||
headers: {},
|
||||
https: {}
|
||||
}
|
||||
|
||||
const tlsSkipVerify = core.getInput('tlsSkipVerify', { required: false }) != 'false';
|
||||
if (tlsSkipVerify == true) {
|
||||
defaultOptions.https.rejectUnauthorized = true;
|
||||
}
|
||||
|
||||
const caCertificateRaw = core.getInput('caCertificate', { required: false });
|
||||
if (caCertificateRaw != null) {
|
||||
defaultOptions.https.certificateAuthority = Buffer.from(caCertificateRaw, 'base64').toString();
|
||||
}
|
||||
|
||||
const clientCertificateRaw = core.getInput('clientCertificate', { required: false });
|
||||
if (clientCertificateRaw != null) {
|
||||
defaultOptions.https.certificate = Buffer.from(clientCertificateRaw, 'base64').toString();
|
||||
}
|
||||
|
||||
const clientKeyRaw = core.getInput('clientKey', { required: false });
|
||||
if (clientKeyRaw != null) {
|
||||
defaultOptions.https.key = Buffer.from(clientKeyRaw, 'base64').toString();
|
||||
}
|
||||
|
||||
for (const [headerName, headerValue] of extraHeaders) {
|
||||
@@ -200,4 +221,4 @@ module.exports = {
|
||||
parseSecretsInput,
|
||||
normalizeOutputKey,
|
||||
parseHeadersInput
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,4 +7,4 @@ const { exportSecrets } = require('./action');
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user