mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 23:43:01 +00:00
use standard environments
This commit is contained in:
37
src/config/config.util.ts
Normal file
37
src/config/config.util.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import * as merge from 'deepmerge';
|
||||
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
import { hasNoValue } from '../app/shared/empty.util';
|
||||
|
||||
import { AppConfig } from './app-config.interface';
|
||||
import { ThemeConfig } from './theme.model';
|
||||
|
||||
const extendEnvironmentWithAppConfig = (env: any, appConfig: AppConfig): void => {
|
||||
extendConfig(env, appConfig);
|
||||
console.log(`Environment extended with app config`);
|
||||
};
|
||||
|
||||
const extendConfig = (config: any, appConfig: AppConfig): void => {
|
||||
const mergeOptions = {
|
||||
arrayMerge: (destinationArray, sourceArray, options) => sourceArray
|
||||
};
|
||||
Object.assign(config, merge.all([
|
||||
config,
|
||||
appConfig
|
||||
], mergeOptions));
|
||||
};
|
||||
|
||||
const getDefaultThemeConfig = (): ThemeConfig => {
|
||||
return environment.themes.find((themeConfig: any) =>
|
||||
hasNoValue(themeConfig.regex) &&
|
||||
hasNoValue(themeConfig.handle) &&
|
||||
hasNoValue(themeConfig.uuid)
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
extendEnvironmentWithAppConfig,
|
||||
extendConfig,
|
||||
getDefaultThemeConfig
|
||||
};
|
Reference in New Issue
Block a user