Skip to content

Instantly share code, notes, and snippets.

@hofiorg
Created March 7, 2019 12:54
Show Gist options
  • Save hofiorg/f76561667ef9dde37483ed8ed58c5d93 to your computer and use it in GitHub Desktop.
Save hofiorg/f76561667ef9dde37483ed8ed58c5d93 to your computer and use it in GitHub Desktop.
SSL Configuration for Vert.x HttpServer
private HttpServer sslConfiguration() {
Boolean ssl = config().getBoolean(CONFIG_SSL, DEFAULT_SSL);
logger.debug(CONFIG_SSL + " " + ssl);
if(ssl) {
String keystoreFile = config().getString(CONFIG_SSL_KEYSTORE_FILE, DEFAULT_SSL_KEYSTORE_FILE);
logger.debug(CONFIG_SSL_KEYSTORE_FILE + " " + keystoreFile);
String keystorePassword = config().getString(CONFIG_SSL_KEYSTORE_PASSWORD, DEFAULT_SSL_KEYSTORE_PASSWORD);
logger.debug(CONFIG_SSL_KEYSTORE_PASSWORD + " " + keystorePassword);
HttpServerOptions options = new HttpServerOptions()
//.setUseAlpn(true)
.setSsl(true)
.setKeyStoreOptions(new JksOptions()
.setPath(keystoreFile)
.setPassword(keystorePassword));
return vertx.createHttpServer(options);
}
return vertx.createHttpServer();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment