From 10a2d7e9ae830a4900b1d6477cd5fc425f54a815 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Fri, 14 Nov 2025 19:34:33 +0530 Subject: [PATCH 1/6] chore: unify license key env variables --- .../src/ee/services/license/license-fns.ts | 38 ++++++++++++++++++- .../ee/services/license/license-service.ts | 16 +++++--- .../src/ee/services/license/license-types.ts | 10 +++++ backend/src/server/routes/v1/admin-router.ts | 6 ++- .../offline-usage-report-service.ts | 10 +++-- docs/self-hosting/ee.mdx | 15 ++++---- 6 files changed, 76 insertions(+), 19 deletions(-) diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.ts index 14b7bcfbd..fca2455b0 100644 --- a/backend/src/ee/services/license/license-fns.ts +++ b/backend/src/ee/services/license/license-fns.ts @@ -7,7 +7,43 @@ import { BadRequestError } from "@app/lib/errors"; import { logger } from "@app/lib/logger"; import { UserAliasType } from "@app/services/user-alias/user-alias-types"; -import { TFeatureSet } from "./license-types"; +import { TFeatureSet, TLicenseKeyConfig, TOfflineLicenseContents } from "./license-types"; + +const getOfflineLicenseContents = (licenseKey: string): TOfflineLicenseContents => { + return JSON.parse(Buffer.from(licenseKey, "base64").toString("utf8")) as TOfflineLicenseContents; +}; + +export const isOfflineLicenseKey = (licenseKey: string): boolean => { + const contents = getOfflineLicenseContents(licenseKey); + return "signature" in contents && "license" in contents; +}; + +export const getLicenseKeyConfig = (): TLicenseKeyConfig => { + const cfg = getConfig(); + + const licenseKey = cfg.LICENSE_KEY; + + if (licenseKey) { + if (isOfflineLicenseKey(licenseKey)) { + return { isValid: true, licenseKey, type: "offline" }; + } + + return { isValid: true, licenseKey, type: "online" }; + } + + const offlineLicenseKey = cfg.LICENSE_KEY_OFFLINE; + + // backwards compatibility + if (offlineLicenseKey) { + if (isOfflineLicenseKey(offlineLicenseKey)) { + return { isValid: true, licenseKey: offlineLicenseKey, type: "offline" }; + } + + return { isValid: false }; + } + + return { isValid: false }; +}; export const getDefaultOnPremFeatures = (): TFeatureSet => ({ _id: null, diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.ts index bbd6147ed..04e77f259 100644 --- a/backend/src/ee/services/license/license-service.ts +++ b/backend/src/ee/services/license/license-service.ts @@ -22,7 +22,7 @@ import { OrgPermissionBillingActions, OrgPermissionSubjects } from "../permissio import { TPermissionServiceFactory } from "../permission/permission-service-types"; import { BillingPlanRows, BillingPlanTableHead } from "./licence-enums"; import { TLicenseDALFactory } from "./license-dal"; -import { getDefaultOnPremFeatures, setupLicenseRequestWithStore } from "./license-fns"; +import { getDefaultOnPremFeatures, getLicenseKeyConfig, setupLicenseRequestWithStore } from "./license-fns"; import { InstanceType, TAddOrgPmtMethodDTO, @@ -77,6 +77,7 @@ export const licenseServiceFactory = ({ let instanceType = InstanceType.OnPrem; let onPremFeatures: TFeatureSet = getDefaultOnPremFeatures(); let selfHostedLicense: TOfflineLicense | null = null; + const licenseKeyConfig = getLicenseKeyConfig(); const licenseServerCloudApi = setupLicenseRequestWithStore( envConfig.LICENSE_SERVER_URL || "", @@ -85,10 +86,13 @@ export const licenseServiceFactory = ({ envConfig.INTERNAL_REGION ); + const onlineLicenseKey = + licenseKeyConfig.isValid && licenseKeyConfig.type === "online" ? licenseKeyConfig.licenseKey : ""; + const licenseServerOnPremApi = setupLicenseRequestWithStore( envConfig.LICENSE_SERVER_URL || "", LICENSE_SERVER_ON_PREM_LOGIN, - envConfig.LICENSE_KEY || "", + onlineLicenseKey, envConfig.INTERNAL_REGION ); @@ -131,7 +135,7 @@ export const licenseServiceFactory = ({ return; } - if (envConfig.LICENSE_KEY) { + if (licenseKeyConfig.isValid && licenseKeyConfig.type === "online") { const token = await licenseServerOnPremApi.refreshLicense(); if (token) { await syncLicenseKeyOnPremFeatures(true); @@ -142,10 +146,10 @@ export const licenseServiceFactory = ({ return; } - if (envConfig.LICENSE_KEY_OFFLINE) { + if (licenseKeyConfig.isValid && licenseKeyConfig.type === "offline") { let isValidOfflineLicense = true; const contents: TOfflineLicenseContents = JSON.parse( - Buffer.from(envConfig.LICENSE_KEY_OFFLINE, "base64").toString("utf8") + Buffer.from(licenseKeyConfig.licenseKey, "base64").toString("utf8") ); const isVerified = await verifyOfflineLicense(JSON.stringify(contents.license), contents.signature); @@ -184,7 +188,7 @@ export const licenseServiceFactory = ({ }; const initializeBackgroundSync = async () => { - if (envConfig.LICENSE_KEY) { + if (licenseKeyConfig?.isValid && licenseKeyConfig?.type === "online") { logger.info("Setting up background sync process for refresh onPremFeatures"); const job = new CronJob("*/10 * * * *", syncLicenseKeyOnPremFeatures); job.start(); diff --git a/backend/src/ee/services/license/license-types.ts b/backend/src/ee/services/license/license-types.ts index 5157b0730..1fd11fabf 100644 --- a/backend/src/ee/services/license/license-types.ts +++ b/backend/src/ee/services/license/license-types.ts @@ -136,3 +136,13 @@ export type TDelOrgTaxIdDTO = TOrgPermission & { taxId: string }; export type TOrgInvoiceDTO = TOrgPermission; export type TOrgLicensesDTO = TOrgPermission; + +export type TLicenseKeyConfig = + | { + isValid: false; + } + | { + isValid: true; + licenseKey: string; + type: "offline" | "online"; + }; diff --git a/backend/src/server/routes/v1/admin-router.ts b/backend/src/server/routes/v1/admin-router.ts index ddb3f2326..858633642 100644 --- a/backend/src/server/routes/v1/admin-router.ts +++ b/backend/src/server/routes/v1/admin-router.ts @@ -9,6 +9,7 @@ import { SuperAdminSchema, UsersSchema } from "@app/db/schemas"; +import { getLicenseKeyConfig } from "@app/ee/services/license/license-fns"; import { getConfig, overridableKeys } from "@app/lib/config/env"; import { crypto } from "@app/lib/crypto/cryptography"; import { BadRequestError } from "@app/lib/errors"; @@ -65,6 +66,9 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => { const config = await getServerCfg(); const serverEnvs = getConfig(); + const licenseKeyConfig = getLicenseKeyConfig(); + const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === "offline"; + return { config: { ...config, @@ -73,7 +77,7 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => { isSecretScanningDisabled: serverEnvs.DISABLE_SECRET_SCANNING, kubernetesAutoFetchServiceAccountToken: serverEnvs.KUBERNETES_AUTO_FETCH_SERVICE_ACCOUNT_TOKEN, paramsFolderSecretDetectionEnabled: serverEnvs.PARAMS_FOLDER_SECRET_DETECTION_ENABLED, - isOfflineUsageReportsEnabled: !!serverEnvs.LICENSE_KEY_OFFLINE + isOfflineUsageReportsEnabled: hasOfflineLicense } }; } diff --git a/backend/src/services/offline-usage-report/offline-usage-report-service.ts b/backend/src/services/offline-usage-report/offline-usage-report-service.ts index 179232aa4..92360ca52 100644 --- a/backend/src/services/offline-usage-report/offline-usage-report-service.ts +++ b/backend/src/services/offline-usage-report/offline-usage-report-service.ts @@ -1,7 +1,7 @@ import crypto from "crypto"; +import { getLicenseKeyConfig } from "@app/ee/services/license/license-fns"; import { TLicenseServiceFactory } from "@app/ee/services/license/license-service"; -import { getConfig } from "@app/lib/config/env"; import { BadRequestError } from "@app/lib/errors"; import { TOfflineUsageReportDALFactory } from "./offline-usage-report-dal"; @@ -30,10 +30,12 @@ export const offlineUsageReportServiceFactory = ({ }; const generateUsageReportCSV = async () => { - const cfg = getConfig(); - if (!cfg.LICENSE_KEY_OFFLINE) { + const licenseKeyConfig = getLicenseKeyConfig(); + const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === "offline"; + + if (!hasOfflineLicense) { throw new BadRequestError({ - message: "Offline usage reports are not enabled. LICENSE_KEY_OFFLINE must be configured." + message: "Offline usage reports are not enabled. An offline license must be configured in LICENSE_KEY." }); } diff --git a/docs/self-hosting/ee.mdx b/docs/self-hosting/ee.mdx index 83b2772e4..ea32c416c 100644 --- a/docs/self-hosting/ee.mdx +++ b/docs/self-hosting/ee.mdx @@ -14,14 +14,13 @@ This guide walks through how you can use these paid features on a self-hosted in Once purchased, you will be issued a license key. - Depending on whether or not the environment where Infisical is deployed has internet access, you may be issued a regular license or an offline license. + Assign the issued license key to the `LICENSE_KEY` environment variable in your Infisical instance. The system will automatically detect whether the license is online or offline. - - Assign the issued license key to the `LICENSE_KEY` environment variable in your Infisical instance. - - Your Infisical instance will need to communicate with the Infisical license server to validate the license key. + - Your Infisical instance will need to communicate with the Infisical license server to validate the license key. If you want to limit outgoing connections only to the Infisical license server, you can use the following IP addresses: `13.248.249.247` and `35.71.190.59` @@ -29,16 +28,18 @@ This guide walks through how you can use these paid features on a self-hosted in - - Assign the issued license key to the `LICENSE_KEY_OFFLINE` environment variable in your Infisical instance. + - Assign the issued offline license key to the `LICENSE_KEY` environment variable in your Infisical instance. + + - The system will automatically detect that it's an offline license based on the key format. - How you set the environment variable will depend on the deployment method you used. Please refer to the documentation of your deployment method for specific instructions. + Backwards Compatibility: The `LICENSE_KEY_OFFLINE` environment variable is still supported for backwards compatibility, but we recommend using `LICENSE_KEY` for all license types going forward. - Once your instance starts up, the license key will be validated and you’ll be able to use the paid features. + Once your instance starts up, the license key will be validated and you'll be able to use the paid features. However, when the license expires, Infisical will continue to run, but EE features will be disabled until the license is renewed or a new one is purchased. - + From c2bdd12dd56890dbab41d0d32a56c2fe99965ab9 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Fri, 14 Nov 2025 20:37:44 +0530 Subject: [PATCH 2/6] refactor: enhance license key handling and error management --- .../src/ee/services/license/license-fns.ts | 25 ++++++++++++------- .../ee/services/license/license-service.ts | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.ts index fca2455b0..4231ba3c2 100644 --- a/backend/src/ee/services/license/license-fns.ts +++ b/backend/src/ee/services/license/license-fns.ts @@ -1,7 +1,7 @@ import axios, { AxiosError } from "axios"; import { TLicenseServiceFactory } from "@app/ee/services/license/license-service"; -import { getConfig } from "@app/lib/config/env"; +import { getConfig, TEnvConfig } from "@app/lib/config/env"; import { request } from "@app/lib/config/request"; import { BadRequestError } from "@app/lib/errors"; import { logger } from "@app/lib/logger"; @@ -9,17 +9,24 @@ import { UserAliasType } from "@app/services/user-alias/user-alias-types"; import { TFeatureSet, TLicenseKeyConfig, TOfflineLicenseContents } from "./license-types"; -const getOfflineLicenseContents = (licenseKey: string): TOfflineLicenseContents => { - return JSON.parse(Buffer.from(licenseKey, "base64").toString("utf8")) as TOfflineLicenseContents; -}; - export const isOfflineLicenseKey = (licenseKey: string): boolean => { - const contents = getOfflineLicenseContents(licenseKey); - return "signature" in contents && "license" in contents; + try { + const contents = JSON.parse(Buffer.from(licenseKey, "base64").toString("utf8")) as TOfflineLicenseContents; + + return "signature" in contents && "license" in contents; + } catch (error) { + return false; + } }; -export const getLicenseKeyConfig = (): TLicenseKeyConfig => { - const cfg = getConfig(); +export const getLicenseKeyConfig = ( + config?: Pick +): TLicenseKeyConfig => { + const cfg = config || getConfig(); + + if (!cfg) { + return { isValid: false }; + } const licenseKey = cfg.LICENSE_KEY; diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.ts index 04e77f259..080556ca5 100644 --- a/backend/src/ee/services/license/license-service.ts +++ b/backend/src/ee/services/license/license-service.ts @@ -77,7 +77,7 @@ export const licenseServiceFactory = ({ let instanceType = InstanceType.OnPrem; let onPremFeatures: TFeatureSet = getDefaultOnPremFeatures(); let selfHostedLicense: TOfflineLicense | null = null; - const licenseKeyConfig = getLicenseKeyConfig(); + const licenseKeyConfig = getLicenseKeyConfig(envConfig); const licenseServerCloudApi = setupLicenseRequestWithStore( envConfig.LICENSE_SERVER_URL || "", From d951c40aba3d351988132994b4c85b2d2d76ecf8 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Mon, 17 Nov 2025 21:05:25 +0530 Subject: [PATCH 3/6] fix: review suggestions --- backend/src/ee/services/license/license-fns.ts | 8 ++++---- backend/src/ee/services/license/license-service.ts | 9 +++++---- backend/src/ee/services/license/license-types.ts | 7 ++++++- backend/src/server/routes/v1/admin-router.ts | 3 ++- .../offline-usage-report/offline-usage-report-service.ts | 3 ++- docs/self-hosting/ee.mdx | 4 ++-- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.ts index 4231ba3c2..09ff9e108 100644 --- a/backend/src/ee/services/license/license-fns.ts +++ b/backend/src/ee/services/license/license-fns.ts @@ -7,7 +7,7 @@ import { BadRequestError } from "@app/lib/errors"; import { logger } from "@app/lib/logger"; import { UserAliasType } from "@app/services/user-alias/user-alias-types"; -import { TFeatureSet, TLicenseKeyConfig, TOfflineLicenseContents } from "./license-types"; +import { LicenseType, TFeatureSet, TLicenseKeyConfig, TOfflineLicenseContents } from "./license-types"; export const isOfflineLicenseKey = (licenseKey: string): boolean => { try { @@ -32,10 +32,10 @@ export const getLicenseKeyConfig = ( if (licenseKey) { if (isOfflineLicenseKey(licenseKey)) { - return { isValid: true, licenseKey, type: "offline" }; + return { isValid: true, licenseKey, type: LicenseType.Offline }; } - return { isValid: true, licenseKey, type: "online" }; + return { isValid: true, licenseKey, type: LicenseType.Online }; } const offlineLicenseKey = cfg.LICENSE_KEY_OFFLINE; @@ -43,7 +43,7 @@ export const getLicenseKeyConfig = ( // backwards compatibility if (offlineLicenseKey) { if (isOfflineLicenseKey(offlineLicenseKey)) { - return { isValid: true, licenseKey: offlineLicenseKey, type: "offline" }; + return { isValid: true, licenseKey: offlineLicenseKey, type: LicenseType.Offline }; } return { isValid: false }; diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.ts index 080556ca5..3bbd58831 100644 --- a/backend/src/ee/services/license/license-service.ts +++ b/backend/src/ee/services/license/license-service.ts @@ -25,6 +25,7 @@ import { TLicenseDALFactory } from "./license-dal"; import { getDefaultOnPremFeatures, getLicenseKeyConfig, setupLicenseRequestWithStore } from "./license-fns"; import { InstanceType, + LicenseType, TAddOrgPmtMethodDTO, TAddOrgTaxIdDTO, TCreateOrgPortalSession, @@ -87,7 +88,7 @@ export const licenseServiceFactory = ({ ); const onlineLicenseKey = - licenseKeyConfig.isValid && licenseKeyConfig.type === "online" ? licenseKeyConfig.licenseKey : ""; + licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Online ? licenseKeyConfig.licenseKey : ""; const licenseServerOnPremApi = setupLicenseRequestWithStore( envConfig.LICENSE_SERVER_URL || "", @@ -135,7 +136,7 @@ export const licenseServiceFactory = ({ return; } - if (licenseKeyConfig.isValid && licenseKeyConfig.type === "online") { + if (licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Online) { const token = await licenseServerOnPremApi.refreshLicense(); if (token) { await syncLicenseKeyOnPremFeatures(true); @@ -146,7 +147,7 @@ export const licenseServiceFactory = ({ return; } - if (licenseKeyConfig.isValid && licenseKeyConfig.type === "offline") { + if (licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Offline) { let isValidOfflineLicense = true; const contents: TOfflineLicenseContents = JSON.parse( Buffer.from(licenseKeyConfig.licenseKey, "base64").toString("utf8") @@ -188,7 +189,7 @@ export const licenseServiceFactory = ({ }; const initializeBackgroundSync = async () => { - if (licenseKeyConfig?.isValid && licenseKeyConfig?.type === "online") { + if (licenseKeyConfig?.isValid && licenseKeyConfig?.type === LicenseType.Online) { logger.info("Setting up background sync process for refresh onPremFeatures"); const job = new CronJob("*/10 * * * *", syncLicenseKeyOnPremFeatures); job.start(); diff --git a/backend/src/ee/services/license/license-types.ts b/backend/src/ee/services/license/license-types.ts index 1fd11fabf..8897eaabc 100644 --- a/backend/src/ee/services/license/license-types.ts +++ b/backend/src/ee/services/license/license-types.ts @@ -137,6 +137,11 @@ export type TOrgInvoiceDTO = TOrgPermission; export type TOrgLicensesDTO = TOrgPermission; +export enum LicenseType { + Offline = "offline", + Online = "online" +} + export type TLicenseKeyConfig = | { isValid: false; @@ -144,5 +149,5 @@ export type TLicenseKeyConfig = | { isValid: true; licenseKey: string; - type: "offline" | "online"; + type: LicenseType; }; diff --git a/backend/src/server/routes/v1/admin-router.ts b/backend/src/server/routes/v1/admin-router.ts index 858633642..f6ec36f6f 100644 --- a/backend/src/server/routes/v1/admin-router.ts +++ b/backend/src/server/routes/v1/admin-router.ts @@ -10,6 +10,7 @@ import { UsersSchema } from "@app/db/schemas"; import { getLicenseKeyConfig } from "@app/ee/services/license/license-fns"; +import { LicenseType } from "@app/ee/services/license/license-types"; import { getConfig, overridableKeys } from "@app/lib/config/env"; import { crypto } from "@app/lib/crypto/cryptography"; import { BadRequestError } from "@app/lib/errors"; @@ -67,7 +68,7 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => { const serverEnvs = getConfig(); const licenseKeyConfig = getLicenseKeyConfig(); - const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === "offline"; + const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Offline; return { config: { diff --git a/backend/src/services/offline-usage-report/offline-usage-report-service.ts b/backend/src/services/offline-usage-report/offline-usage-report-service.ts index 92360ca52..f05c734c1 100644 --- a/backend/src/services/offline-usage-report/offline-usage-report-service.ts +++ b/backend/src/services/offline-usage-report/offline-usage-report-service.ts @@ -35,7 +35,8 @@ export const offlineUsageReportServiceFactory = ({ if (!hasOfflineLicense) { throw new BadRequestError({ - message: "Offline usage reports are not enabled. An offline license must be configured in LICENSE_KEY." + message: + "Offline usage reports are not enabled. Usage reports are only available for self-hosted offline instances" }); } diff --git a/docs/self-hosting/ee.mdx b/docs/self-hosting/ee.mdx index ea32c416c..9c3e7d644 100644 --- a/docs/self-hosting/ee.mdx +++ b/docs/self-hosting/ee.mdx @@ -14,7 +14,7 @@ This guide walks through how you can use these paid features on a self-hosted in Once purchased, you will be issued a license key. - Assign the issued license key to the `LICENSE_KEY` environment variable in your Infisical instance. The system will automatically detect whether the license is online or offline. + Set your license key as the value of the **LICENSE_KEY** environment variable within your Infisical instance. @@ -33,7 +33,7 @@ This guide walks through how you can use these paid features on a self-hosted in - The system will automatically detect that it's an offline license based on the key format. - Backwards Compatibility: The `LICENSE_KEY_OFFLINE` environment variable is still supported for backwards compatibility, but we recommend using `LICENSE_KEY` for all license types going forward. + While the LICENSE_KEY_OFFLINE environment variable continues to be supported for compatibility with existing configurations, we recommend transitioning to LICENSE_KEY for all license types going forward. From 4a56c7ea4601958565af26b906901c2dc294f3ae Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Tue, 18 Nov 2025 02:11:07 +0530 Subject: [PATCH 4/6] fix: e2e tests --- .../services/license/__mocks__/license-fns.ts | 6 ++++ backend/src/server/routes/index.ts | 33 ++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/backend/src/ee/services/license/__mocks__/license-fns.ts b/backend/src/ee/services/license/__mocks__/license-fns.ts index d303859bb..2f29e4812 100644 --- a/backend/src/ee/services/license/__mocks__/license-fns.ts +++ b/backend/src/ee/services/license/__mocks__/license-fns.ts @@ -39,3 +39,9 @@ export const getDefaultOnPremFeatures = () => { }; export const setupLicenseRequestWithStore = () => {}; + +export const getLicenseKeyConfig = () => { + return { + isValid: false + }; +}; diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts index 5dd7a1c22..e0508a76a 100644 --- a/backend/src/server/routes/index.ts +++ b/backend/src/server/routes/index.ts @@ -2431,22 +2431,25 @@ export const registerRoutes = async ( } } - await telemetryQueue.startTelemetryCheck(); - await telemetryQueue.startAggregatedEventsJob(); - await dailyResourceCleanUp.init(); - await healthAlert.init(); - await pkiSyncCleanup.init(); - await pamAccountRotation.init(); - await dailyReminderQueueService.startDailyRemindersJob(); - await dailyReminderQueueService.startSecretReminderMigrationJob(); - await dailyExpiringPkiItemAlert.startSendingAlerts(); - await pkiSubscriberQueue.startDailyAutoRenewalJob(); - await pkiAlertV2Queue.init(); - await certificateV3Queue.init(); + if (!appCfg.isTestMode) { + await telemetryQueue.startTelemetryCheck(); + await telemetryQueue.startAggregatedEventsJob(); + await dailyResourceCleanUp.init(); + await healthAlert.init(); + await pkiSyncCleanup.init(); + await pamAccountRotation.init(); + await dailyReminderQueueService.startDailyRemindersJob(); + await dailyReminderQueueService.startSecretReminderMigrationJob(); + await dailyExpiringPkiItemAlert.startSendingAlerts(); + await pkiSubscriberQueue.startDailyAutoRenewalJob(); + await pkiAlertV2Queue.init(); + await certificateV3Queue.init(); + await microsoftTeamsService.start(); + await dynamicSecretQueueService.init(); + await eventBusService.init(); + } + await kmsService.startService(hsmStatus); - await microsoftTeamsService.start(); - await dynamicSecretQueueService.init(); - await eventBusService.init(); // inject all services server.decorate("services", { From ea74b6051e6deaff9373b9fd42c3ce7320ec750d Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Tue, 18 Nov 2025 11:34:06 +0530 Subject: [PATCH 5/6] chore: refactor --- .../offline-usage-report/offline-usage-report-service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/services/offline-usage-report/offline-usage-report-service.ts b/backend/src/services/offline-usage-report/offline-usage-report-service.ts index f05c734c1..1c34425a2 100644 --- a/backend/src/services/offline-usage-report/offline-usage-report-service.ts +++ b/backend/src/services/offline-usage-report/offline-usage-report-service.ts @@ -2,6 +2,7 @@ import crypto from "crypto"; import { getLicenseKeyConfig } from "@app/ee/services/license/license-fns"; import { TLicenseServiceFactory } from "@app/ee/services/license/license-service"; +import { LicenseType } from "@app/ee/services/license/license-types"; import { BadRequestError } from "@app/lib/errors"; import { TOfflineUsageReportDALFactory } from "./offline-usage-report-dal"; @@ -31,7 +32,7 @@ export const offlineUsageReportServiceFactory = ({ const generateUsageReportCSV = async () => { const licenseKeyConfig = getLicenseKeyConfig(); - const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === "offline"; + const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Offline; if (!hasOfflineLicense) { throw new BadRequestError({ From b242ec407d86aad118802047717ef1f226c04a77 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Tue, 18 Nov 2025 18:50:19 +0530 Subject: [PATCH 6/6] fix e2e tests --- backend/src/server/routes/index.ts | 33 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts index e0508a76a..c29fc1b1a 100644 --- a/backend/src/server/routes/index.ts +++ b/backend/src/server/routes/index.ts @@ -2431,25 +2431,22 @@ export const registerRoutes = async ( } } - if (!appCfg.isTestMode) { - await telemetryQueue.startTelemetryCheck(); - await telemetryQueue.startAggregatedEventsJob(); - await dailyResourceCleanUp.init(); - await healthAlert.init(); - await pkiSyncCleanup.init(); - await pamAccountRotation.init(); - await dailyReminderQueueService.startDailyRemindersJob(); - await dailyReminderQueueService.startSecretReminderMigrationJob(); - await dailyExpiringPkiItemAlert.startSendingAlerts(); - await pkiSubscriberQueue.startDailyAutoRenewalJob(); - await pkiAlertV2Queue.init(); - await certificateV3Queue.init(); - await microsoftTeamsService.start(); - await dynamicSecretQueueService.init(); - await eventBusService.init(); - } - await kmsService.startService(hsmStatus); + await telemetryQueue.startTelemetryCheck(); + await telemetryQueue.startAggregatedEventsJob(); + await dailyResourceCleanUp.init(); + await healthAlert.init(); + await pkiSyncCleanup.init(); + await pamAccountRotation.init(); + await dailyReminderQueueService.startDailyRemindersJob(); + await dailyReminderQueueService.startSecretReminderMigrationJob(); + await dailyExpiringPkiItemAlert.startSendingAlerts(); + await pkiSubscriberQueue.startDailyAutoRenewalJob(); + await pkiAlertV2Queue.init(); + await certificateV3Queue.init(); + await microsoftTeamsService.start(); + await dynamicSecretQueueService.init(); + await eventBusService.init(); // inject all services server.decorate("services", {