2015-10-27 22:04:21 -07:00
|
|
|
import clone from 'clone';
|
|
|
|
|
|
2015-10-27 23:54:32 -07:00
|
|
|
const DEFAULT_TRUSTED_PROXIES = [
|
|
|
|
|
'127.0.0.1',
|
|
|
|
|
'::1'
|
|
|
|
|
];
|
|
|
|
|
|
2015-10-27 22:04:21 -07:00
|
|
|
export default class WebConfiguration {
|
|
|
|
|
constructor(config) {
|
|
|
|
|
this.config = config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getEmailContacts() {
|
|
|
|
|
return clone(this.config.contacts);
|
|
|
|
|
}
|
2015-10-27 23:54:32 -07:00
|
|
|
|
|
|
|
|
getTrustedProxies() {
|
|
|
|
|
return DEFAULT_TRUSTED_PROXIES.slice();
|
|
|
|
|
}
|
2015-10-27 22:04:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WebConfiguration.fromOldConfig = function (oldConfig) {
|
|
|
|
|
const config = {
|
|
|
|
|
contacts: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
oldConfig.get('contacts').forEach(contact => {
|
|
|
|
|
config.contacts.push({
|
|
|
|
|
name: contact.name,
|
|
|
|
|
email: contact.email,
|
|
|
|
|
title: contact.title
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return new WebConfiguration(config);
|
|
|
|
|
};
|