Created
February 22, 2021 00:59
-
-
Save asd1245dss/3be0ef72d2a878d010a3604bc55683ca to your computer and use it in GitHub Desktop.
Atlas external js config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'./config/app', | |
'./config/terms-and-conditions', | |
'lodash', | |
], function (app, termsAndConditions, localConfig, gisConfig, lodash) { | |
if (JSON.stringify(localConfig) == JSON.stringify({})) { | |
console.warn('Local configuration not found. Using default values. To use a local configuration and suppress 404 errors, create a file called config-local.js under the /js directory'); | |
} | |
const configs = [app, | |
termsAndConditions, | |
localConfig, | |
gisConfig, | |
] | |
const config = configs.reduce((accumulator, currentValue) => _.mergeWith(accumulator, currentValue, customizer)); | |
function customizer(objValue, srcValue, key) { | |
if (key === 'externalLibraries' && _.isArray(objValue)) { | |
return objValue.concat(srcValue); | |
} | |
if (key === 'authProviders' && _.isArray(srcValue)) { | |
return srcValue; | |
} | |
}; | |
config.webAPIRoot = config.api.url; | |
return config; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'./config/app', | |
'./config/terms-and-conditions', | |
'lodash', | |
], function (app, termsAndConditions, localConfig, gisConfig, lodash) { | |
if (JSON.stringify(localConfig) == JSON.stringify({})) { | |
console.warn('Local configuration not found. Using default values. To use a local configuration and suppress 404 errors, create a file called config-local.js under the /js directory'); | |
} | |
const configs = [app, | |
termsAndConditions, | |
localConfig, | |
gisConfig, | |
] | |
const config = configs.reduce((accumulator, currentValue) => _.mergeWith(accumulator, currentValue, customizer)); | |
function customizer(objValue, srcValue, key) { | |
if (key === 'externalLibraries' && _.isArray(objValue)) { | |
return objValue.concat(srcValue); | |
} | |
if (key === 'authProviders' && _.isArray(srcValue)) { | |
return srcValue; | |
} | |
}; | |
config.webAPIRoot = config.api.url; | |
return config; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment