added logging to certificate loader

This commit is contained in:
Dank074 2021-01-28 00:58:29 -06:00
parent 6d7a52dbad
commit 79c1502635

View File

@ -2,17 +2,21 @@ package org.krews.plugin.nitro.websockets.ssl;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.SslContextBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
public class SSLCertificateLoader { public class SSLCertificateLoader {
private static final String filePath = "ssl"; private static final String filePath = "ssl";
private static final Logger LOGGER = LoggerFactory.getLogger(SSLCertificateLoader.class);
public static SslContext getContext() { public static SslContext getContext() {
SslContext context; SslContext context;
try { try {
context = SslContextBuilder.forServer(new File( filePath + File.separator + "cert.pem" ), new File( filePath + File.separator + "privkey.pem" )).build(); context = SslContextBuilder.forServer(new File( filePath + File.separator + "cert.pem" ), new File( filePath + File.separator + "privkey.pem" )).build();
} catch ( Exception e ) { } catch ( Exception e ) {
LOGGER.info("Unable to load ssl: " + e.getMessage());
context = null; context = null;
} }
return context; return context;