mirror of
https://github.com/Spengreb/sync.git
synced 2026-05-14 03:32:06 +00:00
36 lines
707 B
JavaScript
36 lines
707 B
JavaScript
import clone from 'clone';
|
|
|
|
const DEFAULT_TRUSTED_PROXIES = [
|
|
'127.0.0.1',
|
|
'::1'
|
|
];
|
|
|
|
export default class WebConfiguration {
|
|
constructor(config) {
|
|
this.config = config;
|
|
}
|
|
|
|
getEmailContacts() {
|
|
return clone(this.config.contacts);
|
|
}
|
|
|
|
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);
|
|
};
|