2015-07-14 17:12:32 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-01-04 13:08:32 +01:00
|
|
|
import AppConstants from '../constants/application_constants';
|
|
|
|
|
|
|
|
export function getDefaultSubdomainSettings() {
|
|
|
|
return AppConstants.defaultDomain;
|
|
|
|
}
|
2015-07-14 17:12:32 +02:00
|
|
|
|
|
|
|
export function getSubdomainSettings(subdomain) {
|
2016-01-04 13:08:32 +01:00
|
|
|
const settings = AppConstants.subdomains.filter((sdSettings) => subdomain === sdSettings.subdomain);
|
2015-07-14 17:12:32 +02:00
|
|
|
|
2016-01-04 13:08:32 +01:00
|
|
|
if (settings.length === 1) {
|
2015-07-14 17:12:32 +02:00
|
|
|
return settings[0];
|
2016-01-04 13:08:32 +01:00
|
|
|
} else if (settings.length === 0) {
|
2015-10-01 16:59:44 +02:00
|
|
|
console.warn('There are no subdomain settings for the subdomain: ' + subdomain);
|
2016-01-04 13:08:32 +01:00
|
|
|
return AppConstants.defaultDomain;
|
2015-07-14 17:12:32 +02:00
|
|
|
} else {
|
|
|
|
throw new Error('Matched multiple subdomains. Adjust constants file.');
|
|
|
|
}
|
2015-07-27 18:06:02 +02:00
|
|
|
}
|