From 913ead60199dd2e26f3ee7873221a040d6e416f4 Mon Sep 17 00:00:00 2001 From: lotte Date: Fri, 26 Feb 2021 17:27:02 +0100 Subject: [PATCH 1/2] 77237: overwriteMerge environment files merge --- scripts/set-env.ts | 8 ++++---- src/app/core/shared/metadata.utils.ts | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/set-env.ts b/scripts/set-env.ts index 5eee22a4be..b3516ae68f 100644 --- a/scripts/set-env.ts +++ b/scripts/set-env.ts @@ -10,7 +10,7 @@ const targetPath = './src/environments/environment.ts'; const colors = require('colors'); require('dotenv').config(); const merge = require('deepmerge'); - +const mergeOptions = { arrayMerge: (destinationArray, sourceArray, options) => sourceArray }; const environment = process.argv[2]; let environmentFilePath; let production = false; @@ -45,10 +45,10 @@ const processEnv = { } as GlobalConfig; import(environmentFilePath) - .then((file) => generateEnvironmentFile(merge.all([commonEnv, file.environment, processEnv]))) + .then((file) => generateEnvironmentFile(merge.all([commonEnv, file.environment, processEnv], mergeOptions))) .catch(() => { console.log(colors.yellow.bold(`No specific environment file found for ` + environment)); - generateEnvironmentFile(merge(commonEnv, processEnv)) + generateEnvironmentFile(merge(commonEnv, processEnv, mergeOptions)) }); function generateEnvironmentFile(file: GlobalConfig): void { @@ -65,7 +65,7 @@ function generateEnvironmentFile(file: GlobalConfig): void { } // allow to override a few important options by environment variables -function createServerConfig(host?: string, port?: string, nameSpace?: string, ssl?: string): ServerConfig { +function createServerConfig(host?: string, port?: string, nameSpace?: string, ssl?: string): ServerConfig { const result = {} as any; if (hasValue(host)) { result.host = host; diff --git a/src/app/core/shared/metadata.utils.ts b/src/app/core/shared/metadata.utils.ts index 612fba1d4a..41e6afd7f2 100644 --- a/src/app/core/shared/metadata.utils.ts +++ b/src/app/core/shared/metadata.utils.ts @@ -156,7 +156,9 @@ export class Metadata { const outputKeys: string[] = []; for (const inputKey of inputKeys) { if (inputKey.includes('*')) { + const inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\.').replace('*', '.*') + '$'); + for (const mapKey of Object.keys(mdMap)) { if (!outputKeys.includes(mapKey) && inputKeyRegex.test(mapKey)) { outputKeys.push(mapKey); From 4f08ad453f8b1589100ad67a033ab2dcd903a684 Mon Sep 17 00:00:00 2001 From: Raf Ponsaerts Date: Thu, 4 Mar 2021 09:48:27 +0100 Subject: [PATCH 2/2] removed whitelines --- src/app/core/shared/metadata.utils.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/core/shared/metadata.utils.ts b/src/app/core/shared/metadata.utils.ts index 41e6afd7f2..612fba1d4a 100644 --- a/src/app/core/shared/metadata.utils.ts +++ b/src/app/core/shared/metadata.utils.ts @@ -156,9 +156,7 @@ export class Metadata { const outputKeys: string[] = []; for (const inputKey of inputKeys) { if (inputKey.includes('*')) { - const inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\.').replace('*', '.*') + '$'); - for (const mapKey of Object.keys(mdMap)) { if (!outputKeys.includes(mapKey) && inputKeyRegex.test(mapKey)) { outputKeys.push(mapKey);