Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return {
matcher: new Matcher(extractor.matchConfig()),
extractor,
}
});
const impl: AsyncDependencyExtractor = new DependencyExtractorImpl(matchersAndExtractors);
const healthcheck = new health.Implementation({
"": healthv1.HealthCheckResponse.ServingStatus.SERVING,
});
// toggle the service health as such
// healthcheck.setStatus("", healthv1.HealthCheckResponse.ServingStatus.NOT_SERVING);
const server = new Server();
server.addService(DependencyExtractor.service, unasyncify(impl));
server.addService(health.service, healthcheck);
let credentials = ServerCredentials.createInsecure();
if (options.tlsKey && options.tlsCert && options.tlsCa) {
const [ key, cert, ca ] = await Promise.all([
asyncFs.readFile(options.tlsKey),
asyncFs.readFile(options.tlsCert),
asyncFs.readFile(options.tlsCa),
]);
credentials = ServerCredentials.createSsl(ca, [ {
private_key: key,
cert_chain: cert,
} ], true);
}