Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

close all queues

Maidul Islamb11cd29943ce
diff --git a/backend/src/index.ts b/backend/src/index.ts
index 3c6e82180a..17c030fed3 100644
--- a/backend/src/index.ts
+++ b/backend/src/index.ts
@@ -6,7 +6,7 @@ require("express-async-errors");
import helmet from "helmet";
import cors from "cors";
import { DatabaseService } from "./services";
-import { EELicenseService, GithubSecretScanningService} from "./ee/services";
+import { EELicenseService, GithubSecretScanningService } from "./ee/services";
import { setUpHealthEndpoint } from "./services/health";
import cookieParser from "cookie-parser";
import swaggerUi = require("swagger-ui-express");
@@ -72,6 +72,8 @@ import { RouteNotFoundError } from "./utils/errors";
import { requestErrorHandler } from "./middleware/requestErrorHandler";
import { getNodeEnv, getPort, getSecretScanningGitAppId, getSecretScanningPrivateKey, getSecretScanningWebhookProxy, getSecretScanningWebhookSecret, getSiteURL } from "./config";
import { setup } from "./utils/setup";
+import { syncSecretsToThirdPartyServices } from "./queues/integrations/syncSecretsToThirdPartyServices";
+import { githubPushEventSecretScan } from "./queues/secret-scanning/githubScanPushEvent";
const SmeeClient = require('smee-client') // eslint-disable-line
const main = async () => {
@@ -205,6 +207,8 @@ const main = async () => {
server.on("close", async () => {
await DatabaseService.closeDatabase();
+ syncSecretsToThirdPartyServices.close()
+ githubPushEventSecretScan.close()
});
return server;
diff --git a/backend/src/queues/integrations/syncSecretsToThirdPartyServices.ts b/backend/src/queues/integrations/syncSecretsToThirdPartyServices.ts
index 852f059c19..6d998e31f9 100644
--- a/backend/src/queues/integrations/syncSecretsToThirdPartyServices.ts
+++ b/backend/src/queues/integrations/syncSecretsToThirdPartyServices.ts
@@ -11,7 +11,7 @@ type TSyncSecretsToThirdPartyServices = {
environment?: string
}
-const syncSecretsToThirdPartyServices = new Queue('sync-secrets-to-third-party-services', process.env.REDIS_URL as string);
+export const syncSecretsToThirdPartyServices = new Queue('sync-secrets-to-third-party-services', process.env.REDIS_URL as string);
syncSecretsToThirdPartyServices.process(async (job: Job) => {
const { workspaceId, environment }: TSyncSecretsToThirdPartyServices = job.data
diff --git a/backend/src/queues/secret-scanning/githubScanPushEvent.ts b/backend/src/queues/secret-scanning/githubScanPushEvent.ts
index 3c0eb972df..ec7e9e650d 100644
--- a/backend/src/queues/secret-scanning/githubScanPushEvent.ts
+++ b/backend/src/queues/secret-scanning/githubScanPushEvent.ts
@@ -10,7 +10,7 @@ import { convertKeysToLowercase, scanContentAndGetFindings } from "../../ee/serv
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
-const githubPushEventSecretScan = new Queue('github-push-event-secret-scanning', 'redis://redis:6379');
+export const githubPushEventSecretScan = new Queue('github-push-event-secret-scanning', 'redis://redis:6379');
type TScanPushEventQueueDetails = {
organizationId: string,
diff --git a/backend/src/utils/setup/index.ts b/backend/src/utils/setup/index.ts
index aa1e22f90d..f8bc1c881d 100644
--- a/backend/src/utils/setup/index.ts
+++ b/backend/src/utils/setup/index.ts
@@ -18,7 +18,7 @@ import {
backfillServiceTokenMultiScope,
backfillTrustedIps
} from "./backfillData";
-import {
+import {
reencryptBotOrgKeys,
reencryptBotPrivateKeys,
reencryptSecretBlindIndexDataSalts
@@ -26,6 +26,7 @@ import {
import {
getMongoURL,
getNodeEnv,
+ getRedisUrl,
getSentryDSN
} from "../../config";
import { initializePassport } from "../auth";
@@ -41,6 +42,10 @@ import { initializePassport } from "../auth";
* - Re-encrypting data
*/
export const setup = async () => {
+ if (await getRedisUrl() === undefined || await getRedisUrl() === "") {
+ console.error("WARNING: Redis is not yet configured. Infisical may not function as expected without it.")
+ }
+
await validateEncryptionKeysConfig();
await TelemetryService.logTelemetryMessage();
diff --git a/backend/tests/setupTests.ts b/backend/tests/setupTests.ts
index ef30ce85a8..8d259252e0 100644
--- a/backend/tests/setupTests.ts
+++ b/backend/tests/setupTests.ts
@@ -2,6 +2,8 @@ import { Server } from "http";
import main from "../src";
import { afterAll, beforeAll, describe, expect, it } from "@jest/globals";
import request from "supertest";
+import { githubPushEventSecretScan } from "../src/queues/secret-scanning/githubScanPushEvent";
+import { syncSecretsToThirdPartyServices } from "../src/queues/integrations/syncSecretsToThirdPartyServices";
let server: Server;
@@ -11,6 +13,8 @@ beforeAll(async () => {
afterAll(async () => {
server.close();
+ githubPushEventSecretScan.close()
+ syncSecretsToThirdPartyServices.close()
});
describe("Healthcheck endpoint", () => {