mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 18:28:12 +00:00
misc: added pg queue init flag
This commit is contained in:
@@ -37,7 +37,7 @@ export const auditLogQueueServiceFactory = async ({
|
|||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
|
|
||||||
const pushToLog = async (data: TCreateAuditLogDTO) => {
|
const pushToLog = async (data: TCreateAuditLogDTO) => {
|
||||||
if (appCfg.USE_PG_QUEUE) {
|
if (appCfg.USE_PG_QUEUE && appCfg.SHOULD_INIT_PG_QUEUE) {
|
||||||
await queueService.queuePg<QueueName.AuditLog>(QueueJobs.AuditLog, data, {
|
await queueService.queuePg<QueueName.AuditLog>(QueueJobs.AuditLog, data, {
|
||||||
retryLimit: 10,
|
retryLimit: 10,
|
||||||
retryBackoff: true
|
retryBackoff: true
|
||||||
@@ -52,6 +52,7 @@ export const auditLogQueueServiceFactory = async ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (appCfg.SHOULD_INIT_PG_QUEUE) {
|
||||||
await queueService.startPg<QueueName.AuditLog>(
|
await queueService.startPg<QueueName.AuditLog>(
|
||||||
QueueJobs.AuditLog,
|
QueueJobs.AuditLog,
|
||||||
async ([job]) => {
|
async ([job]) => {
|
||||||
@@ -142,6 +143,7 @@ export const auditLogQueueServiceFactory = async ({
|
|||||||
pollingIntervalSeconds: 0.5
|
pollingIntervalSeconds: 0.5
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
queueService.start(QueueName.AuditLog, async (job) => {
|
queueService.start(QueueName.AuditLog, async (job) => {
|
||||||
const { actor, event, ipAddress, projectId, userAgent, userAgentType } = job.data;
|
const { actor, event, ipAddress, projectId, userAgent, userAgentType } = job.data;
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ const envSchema = z
|
|||||||
HSM_KEY_LABEL: zpStr(z.string().optional()),
|
HSM_KEY_LABEL: zpStr(z.string().optional()),
|
||||||
HSM_SLOT: z.coerce.number().optional().default(0),
|
HSM_SLOT: z.coerce.number().optional().default(0),
|
||||||
|
|
||||||
USE_PG_QUEUE: zodStrBool.default("false")
|
USE_PG_QUEUE: zodStrBool.default("false"),
|
||||||
|
SHOULD_INIT_PG_QUEUE: zodStrBool.default("false")
|
||||||
})
|
})
|
||||||
// To ensure that basic encryption is always possible.
|
// To ensure that basic encryption is always possible.
|
||||||
.refine(
|
.refine(
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
TScanFullRepoEventPayload,
|
TScanFullRepoEventPayload,
|
||||||
TScanPushEventPayload
|
TScanPushEventPayload
|
||||||
} from "@app/ee/services/secret-scanning/secret-scanning-queue/secret-scanning-queue-types";
|
} from "@app/ee/services/secret-scanning/secret-scanning-queue/secret-scanning-queue-types";
|
||||||
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { logger } from "@app/lib/logger";
|
import { logger } from "@app/lib/logger";
|
||||||
import {
|
import {
|
||||||
TFailedIntegrationSyncEmailsPayload,
|
TFailedIntegrationSyncEmailsPayload,
|
||||||
@@ -208,11 +209,15 @@ export const queueServiceFactory = (redisUrl: string, dbConnectionUrl: string) =
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
const initialize = async () => {
|
const initialize = async () => {
|
||||||
|
const appCfg = getConfig();
|
||||||
|
if (appCfg.SHOULD_INIT_PG_QUEUE) {
|
||||||
|
logger.info("Initializing pg-queue...");
|
||||||
await pgBoss.start();
|
await pgBoss.start();
|
||||||
|
|
||||||
pgBoss.on("error", (error) => {
|
pgBoss.on("error", (error) => {
|
||||||
logger.error(error, "pg-queue error");
|
logger.error(error, "pg-queue error");
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const start = <T extends QueueName>(
|
const start = <T extends QueueName>(
|
||||||
|
|||||||
Reference in New Issue
Block a user