mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 17:27:16 +00:00
avoid syncing disabled azure keys
This commit is contained in:
@@ -473,7 +473,7 @@ const syncSecretsAzureKeyVault = async ({
|
|||||||
id: string; // secret URI
|
id: string; // secret URI
|
||||||
value: string;
|
value: string;
|
||||||
attributes: {
|
attributes: {
|
||||||
enabled: true;
|
enabled: boolean;
|
||||||
created: number;
|
created: number;
|
||||||
updated: number;
|
updated: number;
|
||||||
recoveryLevel: string;
|
recoveryLevel: string;
|
||||||
@@ -507,14 +507,21 @@ const syncSecretsAzureKeyVault = async ({
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAzureKeyVaultSecrets = (
|
const getAzureKeyVaultSecrets = await paginateAzureKeyVaultSecrets(`${integration.app}/secrets?api-version=7.3`);
|
||||||
await paginateAzureKeyVaultSecrets(`${integration.app}/secrets?api-version=7.3`)
|
|
||||||
).filter((secret) => secret.attributes.enabled);
|
const enabledAzureKeyVaultSecrets = getAzureKeyVaultSecrets.filter((secret) => secret.attributes.enabled);
|
||||||
|
|
||||||
|
// disabled keys to skip sending updates to
|
||||||
|
const disabledAzureKeyVaultSecretKeys = getAzureKeyVaultSecrets
|
||||||
|
.filter(({ attributes }) => !attributes.enabled)
|
||||||
|
.map((getAzureKeyVaultSecret) => {
|
||||||
|
return getAzureKeyVaultSecret.id.substring(getAzureKeyVaultSecret.id.lastIndexOf("/") + 1);
|
||||||
|
});
|
||||||
|
|
||||||
let lastSlashIndex: number;
|
let lastSlashIndex: number;
|
||||||
const res = (
|
const res = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
getAzureKeyVaultSecrets.map(async (getAzureKeyVaultSecret) => {
|
enabledAzureKeyVaultSecrets.map(async (getAzureKeyVaultSecret) => {
|
||||||
if (!lastSlashIndex) {
|
if (!lastSlashIndex) {
|
||||||
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");
|
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");
|
||||||
}
|
}
|
||||||
@@ -660,6 +667,7 @@ const syncSecretsAzureKeyVault = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
let isSecretSet = false;
|
let isSecretSet = false;
|
||||||
let maxTries = 6;
|
let maxTries = 6;
|
||||||
|
if (disabledAzureKeyVaultSecretKeys.includes(key)) return;
|
||||||
|
|
||||||
while (!isSecretSet && maxTries > 0) {
|
while (!isSecretSet && maxTries > 0) {
|
||||||
// try to set secret
|
// try to set secret
|
||||||
|
|||||||
Reference in New Issue
Block a user