improve filtering

This commit is contained in:
McPizza0
2024-11-26 23:35:32 +01:00
parent 6cf2488326
commit 229706f57f
@@ -507,7 +507,9 @@ const syncSecretsAzureKeyVault = async ({
return result; return result;
}; };
const getAzureKeyVaultSecrets = await paginateAzureKeyVaultSecrets(`${integration.app}/secrets?api-version=7.3`); const getAzureKeyVaultSecrets = (
await paginateAzureKeyVaultSecrets(`${integration.app}/secrets?api-version=7.3`)
).filter((secret) => secret.attributes.enabled);
let lastSlashIndex: number; let lastSlashIndex: number;
const res = ( const res = (
@@ -516,7 +518,6 @@ const syncSecretsAzureKeyVault = async ({
if (!lastSlashIndex) { if (!lastSlashIndex) {
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/"); lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");
} }
if (!getAzureKeyVaultSecret.attributes.enabled) return null;
let azureKeyVaultSecret; let azureKeyVaultSecret;
try { try {
@@ -535,9 +536,7 @@ const syncSecretsAzureKeyVault = async ({
}; };
}) })
) )
) ).reduce(
.filter((secret) => secret !== null)
.reduce(
(obj, secret) => ({ (obj, secret) => ({
...obj, ...obj,
[secret.key]: secret [secret.key]: secret