mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: pr changes
This commit is contained in:
@@ -66,19 +66,24 @@ export type EventStreamClient = {
|
||||
};
|
||||
|
||||
export function createEventStreamClient(redis: Redis, options: IEventStreamClientOpts): EventStreamClient {
|
||||
const rules = options.registered.map((r) => ({
|
||||
subject: options.type,
|
||||
action: "subscribe",
|
||||
conditions: {
|
||||
eventType: r.event,
|
||||
...(r.conditions
|
||||
? {
|
||||
secretPath: r.conditions?.secretPath,
|
||||
environment: r.conditions?.environmentSlug
|
||||
}
|
||||
: {})
|
||||
}
|
||||
}));
|
||||
const rules = options.registered.map((r) => {
|
||||
const secretPath = r.conditions?.secretPath;
|
||||
const hasConditions = r.conditions?.environmentSlug || r.conditions?.secretPath;
|
||||
|
||||
return {
|
||||
subject: options.type,
|
||||
action: "subscribe",
|
||||
conditions: {
|
||||
eventType: r.event,
|
||||
...(hasConditions
|
||||
? {
|
||||
environment: r.conditions?.environmentSlug ?? "",
|
||||
secretPath: r.conditions?.recursive ? { $glob: `${secretPath}/**` } : secretPath
|
||||
}
|
||||
: {})
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
const id = `sse-${nanoid()}`;
|
||||
const control = new AbortController();
|
||||
|
||||
@@ -117,7 +117,8 @@ export const EventRegisterSchema = z.object({
|
||||
conditions: z
|
||||
.object({
|
||||
secretPath: z.string().optional().default("/"),
|
||||
environmentSlug: z.string()
|
||||
environmentSlug: z.string(),
|
||||
recursive: z.boolean().optional().default(false)
|
||||
})
|
||||
.optional()
|
||||
});
|
||||
|
||||
@@ -80,13 +80,15 @@ export const registerEventRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
|
||||
req.body.register.forEach((r) => {
|
||||
const fields = {
|
||||
environment: r.conditions?.environmentSlug ?? "",
|
||||
secretPath: r.conditions?.secretPath ?? "/",
|
||||
eventType: r.event
|
||||
};
|
||||
|
||||
const allowed = info.permission.can(
|
||||
ProjectPermissionSecretActions.Subscribe,
|
||||
subject(ProjectPermissionSub.Secrets, {
|
||||
environment: r.conditions?.environmentSlug ?? "",
|
||||
secretPath: r.conditions?.secretPath ?? "/",
|
||||
eventType: r.event
|
||||
})
|
||||
subject(ProjectPermissionSub.Secrets, fields)
|
||||
);
|
||||
|
||||
if (!allowed) {
|
||||
@@ -94,9 +96,9 @@ export const registerEventRouter = async (server: FastifyZodProvider) => {
|
||||
name: "PermissionDenied",
|
||||
message: `You are not allowed to subscribe on secrets`,
|
||||
details: {
|
||||
event: r.event,
|
||||
environmentSlug: r.conditions?.environmentSlug,
|
||||
secretPath: r.conditions?.secretPath ?? "/"
|
||||
event: fields.eventType,
|
||||
environmentSlug: fields.environment,
|
||||
secretPath: fields.secretPath
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,20 +5,12 @@ description: "Subscribe to events in Infisical for real-time updates"
|
||||
---
|
||||
|
||||
<Info>
|
||||
<strong>Note:</strong> Event Subscriptions is a paid feature.
|
||||
<br />
|
||||
<br />
|
||||
On Infisical Cloud, this feature is available on the <strong>
|
||||
Pro
|
||||
</strong> and <strong>Enterprise</strong> tiers, with each tier providing
|
||||
different event retention periods.
|
||||
<br />
|
||||
For self-hosted deployments, please contact{" "}
|
||||
<a href="mailto:sales@infisical.com">sales@infisical.com</a> to purchase an
|
||||
**Note:** Event Subscriptions is a paid feature. - **Infisical Cloud users:** Event Subscriptions is
|
||||
available under the **Enterprise Tier**. - **Self-Hosted Infisical:** Please
|
||||
contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an
|
||||
enterprise license.
|
||||
</Info>
|
||||
|
||||
## Introduction
|
||||
|
||||
Event Subscriptions in Infisical allow you to receive real-time notifications when specific actions occur within your account or organization. These notifications can include changes to secrets, users, teams, and other important resources.
|
||||
|
||||
@@ -30,9 +22,10 @@ You can currently subscribe to notifications for the following event types:
|
||||
- `secret:updated`: Triggered when a secret is updated.
|
||||
- `secret:deleted`: Triggered when a secret is deleted.
|
||||
|
||||
|
||||
## Permissions Setup
|
||||
|
||||
Proper permissions are required to configure event subscriptions. Follow these steps to set up the necessary permissions:
|
||||
In order to receive events on a supported resource, the identity is required to have a Subscribe permission on that resource. Follow these steps to set up the necessary permissions:
|
||||
|
||||
<Steps>
|
||||
<Step title="Select a project and copy the 'Project ID'">
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 895 KiB After Width: | Height: | Size: 895 KiB |
Reference in New Issue
Block a user