Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function defaultCallback(error, server) {
if (error) {
console.error(error.stack ? error.stack.toString() : error.toString());
} else {
var address = server.address();
console.log(
'hops: Server listening at ' +
url.format({
protocol: hopsConfig.https ? 'https' : 'http',
hostname:
address.address === '0.0.0.0' ? 'localhost' : address.address,
port: address.port,
pathname: hopsConfig.basePath,
})
);
}
}
function defaultCallback(error) {
if (error) {
console.error(error.stack.toString());
} else {
console.log(
'hops: Server listening at ' +
url.format({
protocol: hopsConfig.https ? 'https' : 'http',
hostname:
hopsConfig.host === '0.0.0.0' ? 'localhost' : hopsConfig.host,
port: hopsConfig.port,
pathname: hopsConfig.basePath,
})
);
}
}
module.exports = function getHttpsConfig() {
if (!hopsConfig.https) {
return false;
}
return {
key: readSSLFile('localhost.ssl.key'),
cert: readSSLFile('localhost.ssl.crt'),
ca: readSSLFile('rootca.pem'),
};
};