1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 17:45:10 +01:00
onion/js/utils/constants_utils.js

17 lines
565 B
JavaScript
Raw Normal View History

'use strict';
import appConstants from '../constants/application_constants';
export function getSubdomainSettings(subdomain) {
let settings = appConstants.subdomains.filter((sdSettings) => subdomain === sdSettings.subdomain);
if(settings.length === 1) {
return settings[0];
} else if(settings.length === 0) {
2015-10-01 16:59:44 +02:00
console.warn('There are no subdomain settings for the subdomain: ' + subdomain);
return appConstants.defaultDomain;
} else {
throw new Error('Matched multiple subdomains. Adjust constants file.');
}
}