mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 21:29:20 +00:00
close all queues
This commit is contained in:
@@ -6,7 +6,7 @@ require("express-async-errors");
|
|||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import { DatabaseService } from "./services";
|
import { DatabaseService } from "./services";
|
||||||
import { EELicenseService, GithubSecretScanningService} from "./ee/services";
|
import { EELicenseService, GithubSecretScanningService } from "./ee/services";
|
||||||
import { setUpHealthEndpoint } from "./services/health";
|
import { setUpHealthEndpoint } from "./services/health";
|
||||||
import cookieParser from "cookie-parser";
|
import cookieParser from "cookie-parser";
|
||||||
import swaggerUi = require("swagger-ui-express");
|
import swaggerUi = require("swagger-ui-express");
|
||||||
@@ -72,6 +72,8 @@ import { RouteNotFoundError } from "./utils/errors";
|
|||||||
import { requestErrorHandler } from "./middleware/requestErrorHandler";
|
import { requestErrorHandler } from "./middleware/requestErrorHandler";
|
||||||
import { getNodeEnv, getPort, getSecretScanningGitAppId, getSecretScanningPrivateKey, getSecretScanningWebhookProxy, getSecretScanningWebhookSecret, getSiteURL } from "./config";
|
import { getNodeEnv, getPort, getSecretScanningGitAppId, getSecretScanningPrivateKey, getSecretScanningWebhookProxy, getSecretScanningWebhookSecret, getSiteURL } from "./config";
|
||||||
import { setup } from "./utils/setup";
|
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 SmeeClient = require('smee-client') // eslint-disable-line
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
@@ -205,6 +207,8 @@ const main = async () => {
|
|||||||
|
|
||||||
server.on("close", async () => {
|
server.on("close", async () => {
|
||||||
await DatabaseService.closeDatabase();
|
await DatabaseService.closeDatabase();
|
||||||
|
syncSecretsToThirdPartyServices.close()
|
||||||
|
githubPushEventSecretScan.close()
|
||||||
});
|
});
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type TSyncSecretsToThirdPartyServices = {
|
|||||||
environment?: string
|
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) => {
|
syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
||||||
const { workspaceId, environment }: TSyncSecretsToThirdPartyServices = job.data
|
const { workspaceId, environment }: TSyncSecretsToThirdPartyServices = job.data
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { convertKeysToLowercase, scanContentAndGetFindings } from "../../ee/serv
|
|||||||
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
||||||
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
|
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 = {
|
type TScanPushEventQueueDetails = {
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
backfillServiceTokenMultiScope,
|
backfillServiceTokenMultiScope,
|
||||||
backfillTrustedIps
|
backfillTrustedIps
|
||||||
} from "./backfillData";
|
} from "./backfillData";
|
||||||
import {
|
import {
|
||||||
reencryptBotOrgKeys,
|
reencryptBotOrgKeys,
|
||||||
reencryptBotPrivateKeys,
|
reencryptBotPrivateKeys,
|
||||||
reencryptSecretBlindIndexDataSalts
|
reencryptSecretBlindIndexDataSalts
|
||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
getMongoURL,
|
getMongoURL,
|
||||||
getNodeEnv,
|
getNodeEnv,
|
||||||
|
getRedisUrl,
|
||||||
getSentryDSN
|
getSentryDSN
|
||||||
} from "../../config";
|
} from "../../config";
|
||||||
import { initializePassport } from "../auth";
|
import { initializePassport } from "../auth";
|
||||||
@@ -41,6 +42,10 @@ import { initializePassport } from "../auth";
|
|||||||
* - Re-encrypting data
|
* - Re-encrypting data
|
||||||
*/
|
*/
|
||||||
export const setup = async () => {
|
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 validateEncryptionKeysConfig();
|
||||||
await TelemetryService.logTelemetryMessage();
|
await TelemetryService.logTelemetryMessage();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { Server } from "http";
|
|||||||
import main from "../src";
|
import main from "../src";
|
||||||
import { afterAll, beforeAll, describe, expect, it } from "@jest/globals";
|
import { afterAll, beforeAll, describe, expect, it } from "@jest/globals";
|
||||||
import request from "supertest";
|
import request from "supertest";
|
||||||
|
import { githubPushEventSecretScan } from "../src/queues/secret-scanning/githubScanPushEvent";
|
||||||
|
import { syncSecretsToThirdPartyServices } from "../src/queues/integrations/syncSecretsToThirdPartyServices";
|
||||||
|
|
||||||
let server: Server;
|
let server: Server;
|
||||||
|
|
||||||
@@ -11,6 +13,8 @@ beforeAll(async () => {
|
|||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
server.close();
|
server.close();
|
||||||
|
githubPushEventSecretScan.close()
|
||||||
|
syncSecretsToThirdPartyServices.close()
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Healthcheck endpoint", () => {
|
describe("Healthcheck endpoint", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user