sync/src/configuration/webconfig.js

37 lines
707 B
JavaScript
Raw Normal View History

import clone from 'clone';
2015-10-27 23:54:32 -07:00
const DEFAULT_TRUSTED_PROXIES = [
'127.0.0.1',
'::1'
];
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();
}
}
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);
};