mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
close all queues
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user