mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
77237: overwriteMerge environment files merge
This commit is contained in:
@@ -10,7 +10,7 @@ const targetPath = './src/environments/environment.ts';
|
|||||||
const colors = require('colors');
|
const colors = require('colors');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const merge = require('deepmerge');
|
const merge = require('deepmerge');
|
||||||
|
const mergeOptions = { arrayMerge: (destinationArray, sourceArray, options) => sourceArray };
|
||||||
const environment = process.argv[2];
|
const environment = process.argv[2];
|
||||||
let environmentFilePath;
|
let environmentFilePath;
|
||||||
let production = false;
|
let production = false;
|
||||||
@@ -45,10 +45,10 @@ const processEnv = {
|
|||||||
} as GlobalConfig;
|
} as GlobalConfig;
|
||||||
|
|
||||||
import(environmentFilePath)
|
import(environmentFilePath)
|
||||||
.then((file) => generateEnvironmentFile(merge.all([commonEnv, file.environment, processEnv])))
|
.then((file) => generateEnvironmentFile(merge.all([commonEnv, file.environment, processEnv], mergeOptions)))
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log(colors.yellow.bold(`No specific environment file found for ` + environment));
|
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 {
|
function generateEnvironmentFile(file: GlobalConfig): void {
|
||||||
|
@@ -156,7 +156,9 @@ export class Metadata {
|
|||||||
const outputKeys: string[] = [];
|
const outputKeys: string[] = [];
|
||||||
for (const inputKey of inputKeys) {
|
for (const inputKey of inputKeys) {
|
||||||
if (inputKey.includes('*')) {
|
if (inputKey.includes('*')) {
|
||||||
|
|
||||||
const inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\.').replace('*', '.*') + '$');
|
const inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\.').replace('*', '.*') + '$');
|
||||||
|
|
||||||
for (const mapKey of Object.keys(mdMap)) {
|
for (const mapKey of Object.keys(mdMap)) {
|
||||||
if (!outputKeys.includes(mapKey) && inputKeyRegex.test(mapKey)) {
|
if (!outputKeys.includes(mapKey) && inputKeyRegex.test(mapKey)) {
|
||||||
outputKeys.push(mapKey);
|
outputKeys.push(mapKey);
|
||||||
|
Reference in New Issue
Block a user