mirror of
https://github.com/Spengreb/sync.git
synced 2026-05-14 11:42:04 +00:00
24 lines
505 B
JavaScript
24 lines
505 B
JavaScript
|
|
export default class IOConfiguration {
|
||
|
|
constructor(config) {
|
||
|
|
this.config = config;
|
||
|
|
}
|
||
|
|
|
||
|
|
getSocketURL() {
|
||
|
|
return this.config.urls[0];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
IOConfiguration.fromOldConfig = function (oldConfig) {
|
||
|
|
const config = {
|
||
|
|
urls: []
|
||
|
|
};
|
||
|
|
|
||
|
|
['ipv4-ssl', 'ipv4-nossl', 'ipv6-ssl', 'ipv6-nossl'].forEach(key => {
|
||
|
|
if (oldConfig.get('io.' + key)) {
|
||
|
|
config.urls.push(oldConfig.get('io.' + key));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return new IOConfiguration(config);
|
||
|
|
};
|