From 1e4ca2f48fd893ae38d8de93a63ce4c03328b029 Mon Sep 17 00:00:00 2001 From: carlosmonastyrski Date: Mon, 26 May 2025 08:50:28 -0300 Subject: [PATCH 1/3] Fix CLI custom headers doc tip --- docs/cli/usage.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cli/usage.mdx b/docs/cli/usage.mdx index a77a648d0..a3bfd83f0 100644 --- a/docs/cli/usage.mdx +++ b/docs/cli/usage.mdx @@ -130,7 +130,7 @@ The CLI is designed for a variety of secret management applications ranging from export INFISICAL_CUSTOM_HEADERS="Access-Client-Id=your-client-id Access-Client-Secret=your-client-secret" # Execute Infisical commands after setting the environment variable - infisical secrets ls + infisical secrets ``` This functionality enables secure interaction with Infisical instances that require specific authentication headers. From 1407a122b9df38c079cfb6dcf8efdd1e6c37254f Mon Sep 17 00:00:00 2001 From: = Date: Tue, 27 May 2025 15:50:48 +0530 Subject: [PATCH 2/3] feat: added region flag --- backend/src/ee/services/license/license-fns.ts | 13 ++++++++++--- backend/src/ee/services/license/license-service.ts | 6 ++++-- backend/src/lib/config/env.ts | 7 ++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.ts index d8ca362bd..231a35d0d 100644 --- a/backend/src/ee/services/license/license-fns.ts +++ b/backend/src/ee/services/license/license-fns.ts @@ -60,12 +60,19 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({ enterpriseAppConnections: false }); -export const setupLicenseRequestWithStore = (baseURL: string, refreshUrl: string, licenseKey: string) => { +export const setupLicenseRequestWithStore = ( + baseURL: string, + refreshUrl: string, + licenseKey: string, + region?: string +) => { let token: string; const licenseReq = axios.create({ baseURL, - timeout: 35 * 1000 - // signal: AbortSignal.timeout(60 * 1000) + timeout: 35 * 1000, + headers: { + "x-region": region + } }); const refreshLicense = async () => { diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.ts index ceeebbf7a..cfc42d038 100644 --- a/backend/src/ee/services/license/license-service.ts +++ b/backend/src/ee/services/license/license-service.ts @@ -77,13 +77,15 @@ export const licenseServiceFactory = ({ const licenseServerCloudApi = setupLicenseRequestWithStore( appCfg.LICENSE_SERVER_URL || "", LICENSE_SERVER_CLOUD_LOGIN, - appCfg.LICENSE_SERVER_KEY || "" + appCfg.LICENSE_SERVER_KEY || "", + appCfg.INTERNAL_REGION ); const licenseServerOnPremApi = setupLicenseRequestWithStore( appCfg.LICENSE_SERVER_URL || "", LICENSE_SERVER_ON_PREM_LOGIN, - appCfg.LICENSE_KEY || "" + appCfg.LICENSE_KEY || "", + appCfg.INTERNAL_REGION ); const syncLicenseKeyOnPremFeatures = async (shouldThrow: boolean = false) => { diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts index 198ccb9bf..29aa68246 100644 --- a/backend/src/lib/config/env.ts +++ b/backend/src/lib/config/env.ts @@ -245,7 +245,6 @@ const envSchema = z DATADOG_HOSTNAME: zpStr(z.string().optional()), /* CORS ----------------------------------------------------------------------------- */ - CORS_ALLOWED_ORIGINS: zpStr( z .string() @@ -255,7 +254,6 @@ const envSchema = z return JSON.parse(val) as string[]; }) ), - CORS_ALLOWED_HEADERS: zpStr( z .string() @@ -264,7 +262,10 @@ const envSchema = z if (!val) return undefined; return JSON.parse(val) as string[]; }) - ) + ), + + /* INTERNAL ----------------------------------------------------------------------------- */ + INTERNAL_REGION: zpStr(z.string().optional()) }) // To ensure that basic encryption is always possible. .refine( From 1a89f2a479986d4dcf89e39ad93232aee1d9a4c3 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 27 May 2025 19:17:06 +0530 Subject: [PATCH 3/3] feat: added missing validation --- backend/src/lib/config/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts index 29aa68246..9aed17f42 100644 --- a/backend/src/lib/config/env.ts +++ b/backend/src/lib/config/env.ts @@ -265,7 +265,7 @@ const envSchema = z ), /* INTERNAL ----------------------------------------------------------------------------- */ - INTERNAL_REGION: zpStr(z.string().optional()) + INTERNAL_REGION: zpStr(z.enum(["us", "eu"]).optional()) }) // To ensure that basic encryption is always possible. .refine(