Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server.discoveryConfiguration = discoveryConfiguration;
if (discoveryConfiguration) {
const endpointUrl = serverInfo.discoveryUrls[0];
const parsedUrl = url.parse(endpointUrl);
const options ={
applicationUri: serverInfo.applicationUri,
port: parseInt(parsedUrl.port,10),
path: parsedUrl.pathname || "/",
capabilities: server.discoveryConfiguration.serverCapabilities || [ "DA" ]
};
// let's announce the server on the mutlicast DNS
server.bonjourEntry = _announceServerOnMulticastSubnet(discoveryServer.bonjour, options);
}
discoveryServer.registered_servers[key].serverInfo = serverInfo;
} else {
if (key in discoveryServer.registered_servers) {
const server = discoveryServer.registered_servers[key];
debugLog(chalk.cyan("unregistering server : "), server.serverUri.yellow);
if (server.bonjourEntry) {
server.bonjourEntry.stop();
server.bonjourEntry = null;
}
delete discoveryServer.registered_servers[key];
}
}