mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 03:53:02 +00:00
seperate exception handling and always build base urls
This commit is contained in:
@@ -13,6 +13,8 @@ let production = false;
|
|||||||
|
|
||||||
let ENV_CONFIG: GlobalConfig;
|
let ENV_CONFIG: GlobalConfig;
|
||||||
|
|
||||||
|
let envConfigOverride: GlobalConfig;
|
||||||
|
|
||||||
let envConfigFile: string;
|
let envConfigFile: string;
|
||||||
|
|
||||||
// check process.env.NODE_ENV to determine which environment config to use
|
// check process.env.NODE_ENV to determine which environment config to use
|
||||||
@@ -42,18 +44,24 @@ try {
|
|||||||
// if envConfigFile set try to get configs
|
// if envConfigFile set try to get configs
|
||||||
if (envConfigFile) {
|
if (envConfigFile) {
|
||||||
try {
|
try {
|
||||||
merge(configContext(envConfigFile) as GlobalConfig);
|
envConfigOverride = configContext(envConfigFile) as GlobalConfig;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('Cannot find file ' + envConfigFile.substring(2, envConfigFile.length), 'Using default environment.');
|
console.warn('Cannot find file ' + envConfigFile.substring(2, envConfigFile.length), 'Using default environment');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
merge(envConfigOverride);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Unable to merge the default environment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildBaseUrls();
|
||||||
|
|
||||||
// set config for whether running in production
|
// set config for whether running in production
|
||||||
ENV_CONFIG.production = production;
|
ENV_CONFIG.production = production;
|
||||||
|
|
||||||
function merge(config: GlobalConfig): void {
|
function merge(config: GlobalConfig): void {
|
||||||
innerMerge(ENV_CONFIG, config);
|
innerMerge(ENV_CONFIG, config);
|
||||||
buildBaseUrls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function innerMerge(globalConfig: Config, config: Config): void {
|
function innerMerge(globalConfig: Config, config: Config): void {
|
||||||
|
Reference in New Issue
Block a user