mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 03:27:38 +00:00
feat(secret-rotation): updated lottie and added side effect on successfully
This commit is contained in:
@@ -859,6 +859,14 @@ export const createSecretByNameBatch = async (req: Request, res: Response) => {
|
|||||||
authData: req.authData
|
authData: req.authData
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await EventService.handleEvent({
|
||||||
|
event: eventPushSecrets({
|
||||||
|
workspaceId: new Types.ObjectId(workspaceId),
|
||||||
|
environment,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
secrets: createdSecrets
|
secrets: createdSecrets
|
||||||
});
|
});
|
||||||
@@ -903,6 +911,14 @@ export const updateSecretByNameBatch = async (req: Request, res: Response) => {
|
|||||||
authData: req.authData
|
authData: req.authData
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await EventService.handleEvent({
|
||||||
|
event: eventPushSecrets({
|
||||||
|
workspaceId: new Types.ObjectId(workspaceId),
|
||||||
|
environment,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
secrets: updatedSecrets
|
secrets: updatedSecrets
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Client as PgClient } from "pg";
|
|||||||
import mysql from "mysql";
|
import mysql from "mysql";
|
||||||
|
|
||||||
import { client, getRootEncryptionKey } from "../../config";
|
import { client, getRootEncryptionKey } from "../../config";
|
||||||
import { BotService, TelemetryService } from "../../services";
|
import { BotService, EventService, TelemetryService } from "../../services";
|
||||||
import { SecretRotation } from "./models";
|
import { SecretRotation } from "./models";
|
||||||
import { rotationTemplates } from "./templates";
|
import { rotationTemplates } from "./templates";
|
||||||
import {
|
import {
|
||||||
@@ -26,6 +26,7 @@ import { ISecret, Secret } from "../../models";
|
|||||||
import { SECRET_SHARED } from "../../variables";
|
import { SECRET_SHARED } from "../../variables";
|
||||||
import { EESecretService } from "../services";
|
import { EESecretService } from "../services";
|
||||||
import { SecretVersion } from "../models";
|
import { SecretVersion } from "../models";
|
||||||
|
import { eventPushSecrets } from "../../events";
|
||||||
|
|
||||||
const REGEX = /\${([^}]+)}/g;
|
const REGEX = /\${([^}]+)}/g;
|
||||||
const SLUG_ALPHABETS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
const SLUG_ALPHABETS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
@@ -380,8 +381,15 @@ secretRotationQueue.process(async (job: Job) => {
|
|||||||
folderId
|
folderId
|
||||||
});
|
});
|
||||||
|
|
||||||
const postHogClient = await TelemetryService.getPostHogClient();
|
await EventService.handleEvent({
|
||||||
|
event: eventPushSecrets({
|
||||||
|
workspaceId: secretRotation.workspace,
|
||||||
|
environment: secretRotation.environment,
|
||||||
|
secretPath: secretRotation.secretPath
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const postHogClient = await TelemetryService.getPostHogClient();
|
||||||
if (postHogClient) {
|
if (postHogClient) {
|
||||||
postHogClient.capture({
|
postHogClient.capture({
|
||||||
event: "secrets rotated",
|
event: "secrets rotated",
|
||||||
@@ -401,6 +409,7 @@ secretRotationQueue.process(async (job: Job) => {
|
|||||||
lastRotatedAt: new Date().toUTCString()
|
lastRotatedAt: new Date().toUTCString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -505,7 +505,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
}
|
}
|
||||||
icon="rotation"
|
icon="rotation"
|
||||||
>
|
>
|
||||||
Secret rotation
|
Secret Rotation
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -517,7 +517,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
}
|
}
|
||||||
icon="system-outline-189-domain-verification"
|
icon="system-outline-189-domain-verification"
|
||||||
>
|
>
|
||||||
Secret approvals
|
Secret Approvals
|
||||||
{Boolean(secretApprovalReqCount?.open) && (
|
{Boolean(secretApprovalReqCount?.open) && (
|
||||||
<span className="ml-2 rounded border border-primary-400 bg-primary-600 py-0.5 px-1 text-xs font-semibold text-black">
|
<span className="ml-2 rounded border border-primary-400 bg-primary-600 py-0.5 px-1 text-xs font-semibold text-black">
|
||||||
{secretApprovalReqCount?.open}
|
{secretApprovalReqCount?.open}
|
||||||
|
|||||||
Reference in New Issue
Block a user