From 81fe1873658b30dc02deb701664b18c715600fd8 Mon Sep 17 00:00:00 2001 From: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:05:56 +0530 Subject: [PATCH] config updates according to devops (#1197) * updated readmeconfig for sheet * added cache for generating target template when only delivery conditions change * added logic for having only 18 target columns if exceed i will create one column with header OTHER_TARGETS * updated config to fetch from devops accordingly * Update index.ts --- utilities/project-factory/src/server/config/index.ts | 8 ++++---- utilities/project-factory/src/server/utils/targetUtils.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/utilities/project-factory/src/server/config/index.ts b/utilities/project-factory/src/server/config/index.ts index 5d454e48b7b..598ea165e4b 100644 --- a/utilities/project-factory/src/server/config/index.ts +++ b/utilities/project-factory/src/server/config/index.ts @@ -17,11 +17,11 @@ const getDBSchemaName = (dbSchema = "") => { // Configuration object containing various environment variables const config = { cacheTime : 300, - enableDynamicTemplateFor: ["MR-DN"], - isCallGenerateWhenDeliveryConditionsDiffer: true, + enableDynamicTemplateFor: process.env.ENABLE_DYNAMIC_TEMPLATE_FOR || "MR-DN", + isCallGenerateWhenDeliveryConditionsDiffer: process.env.IS_CALL_GENERATE_WHEN_DELIVERY_CONDITIONS_DIFFER || false, prefixForMicroplanCampaigns: "MP", - excludeHierarchyTypeFromBoundaryCodes: false, - excludeBoundaryNameAtLastFromBoundaryCodes: false, + excludeHierarchyTypeFromBoundaryCodes: process.env.EXCLUDE_HIERARCHY_TYPE_FROM_BOUNDARY_CODES || false, + excludeBoundaryNameAtLastFromBoundaryCodes: process.env.EXCLUDE_BOUNDARY_NAME_AT_LAST_FROM_BOUNDARY_CODES || false, masterNameForSchemaOfColumnHeaders: "adminSchema", masterNameForSplitBoundariesOn: "hierarchyConfig", boundary: { diff --git a/utilities/project-factory/src/server/utils/targetUtils.ts b/utilities/project-factory/src/server/utils/targetUtils.ts index 06f9b5f079c..74a91782dba 100644 --- a/utilities/project-factory/src/server/utils/targetUtils.ts +++ b/utilities/project-factory/src/server/utils/targetUtils.ts @@ -120,7 +120,8 @@ async function updateTargetColumnsIfDeliveryConditionsDifferForSMC(request: any) function isDynamicTargetTemplateForProjectType(projectType: string) { const projectTypesFromConfig = config?.enableDynamicTemplateFor; - return projectTypesFromConfig?.includes(projectType) ?? false; + const projectTypesArray = projectTypesFromConfig ? projectTypesFromConfig.split(',') : []; + return projectTypesArray.includes(projectType); }