mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 08:26:10 +00:00
Merge pull request #2923 from Infisical/akhilmhdh-patch-azure
fix: resolved azure app config api not pulling all keys
This commit is contained in:
@@ -305,10 +305,16 @@ const syncSecretsAzureAppConfig = async ({
|
|||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCompleteAzureAppConfigValues = async (url: string) => {
|
if (!integration.app || !integration.app.endsWith(".azconfig.io"))
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Invalid Azure App Configuration URL provided."
|
||||||
|
});
|
||||||
|
|
||||||
|
const getCompleteAzureAppConfigValues = async (baseURL: string, url: string) => {
|
||||||
let result: AzureAppConfigKeyValue[] = [];
|
let result: AzureAppConfigKeyValue[] = [];
|
||||||
while (url) {
|
while (url) {
|
||||||
const res = await request.get(url, {
|
const res = await request.get(url, {
|
||||||
|
baseURL,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`
|
Authorization: `Bearer ${accessToken}`
|
||||||
},
|
},
|
||||||
@@ -319,7 +325,7 @@ const syncSecretsAzureAppConfig = async ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
result = result.concat(res.data.items);
|
result = result.concat(res.data.items);
|
||||||
url = res.data.nextLink;
|
url = res.data?.["@nextLink"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -327,11 +333,13 @@ const syncSecretsAzureAppConfig = async ({
|
|||||||
|
|
||||||
const metadata = IntegrationMetadataSchema.parse(integration.metadata);
|
const metadata = IntegrationMetadataSchema.parse(integration.metadata);
|
||||||
|
|
||||||
const azureAppConfigValuesUrl = `${integration.app}/kv?api-version=2023-11-01&key=${metadata.secretPrefix}*${
|
const azureAppConfigValuesUrl = `/kv?api-version=2023-11-01&key=${metadata.secretPrefix}*${
|
||||||
metadata.azureLabel ? `&label=${metadata.azureLabel}` : "&label=%00"
|
metadata.azureLabel ? `&label=${metadata.azureLabel}` : "&label=%00"
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
const azureAppConfigSecrets = (await getCompleteAzureAppConfigValues(azureAppConfigValuesUrl)).reduce(
|
const azureAppConfigSecrets = (
|
||||||
|
await getCompleteAzureAppConfigValues(integration.app, azureAppConfigValuesUrl)
|
||||||
|
).reduce(
|
||||||
(accum, entry) => {
|
(accum, entry) => {
|
||||||
accum[entry.key] = entry.value;
|
accum[entry.key] = entry.value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user