Add secret name to slack notification

This commit is contained in:
carlosmonastyrski
2025-03-06 12:46:43 -03:00
parent 706feafbf2
commit 28c2f1874e
3 changed files with 6 additions and 2 deletions

View File

@@ -1156,7 +1156,8 @@ export const secretApprovalRequestServiceFactory = ({
environment: env.name,
secretPath,
projectId,
requestId: secretApprovalRequest.id
requestId: secretApprovalRequest.id,
secretKeys: [...new Set(Object.values(data).flatMap(arr => arr?.map(item => item.secretName) ?? []))]
}
}
});
@@ -1456,7 +1457,8 @@ export const secretApprovalRequestServiceFactory = ({
environment: env.name,
secretPath,
projectId,
requestId: secretApprovalRequest.id
requestId: secretApprovalRequest.id,
secretKeys: [...new Set(Object.values(data).flatMap(arr => arr?.map(item => item.secretKey) ?? []))]
}
}
});

View File

@@ -50,6 +50,7 @@ const buildSlackPayload = (notification: TSlackNotification) => {
const messageBody = `A secret approval request has been opened by ${payload.userEmail}.
*Environment*: ${payload.environment}
*Secret path*: ${payload.secretPath || "/"}
*Secret${payload.secretKeys.length > 1 ? "s" : ""}*: ${payload.secretKeys.join(', ')}
View the complete details <${appCfg.SITE_URL}/secret-manager/${payload.projectId}/approval?requestId=${
payload.requestId

View File

@@ -62,6 +62,7 @@ export type TSlackNotification =
secretPath: string;
requestId: string;
projectId: string;
secretKeys: string[];
};
}
| {