Add support for reading the http keystore path + keystore password from our config file
This commit is contained in:
parent
5aa0827d18
commit
e4a574852a
@ -6,6 +6,8 @@ mongo.password=
|
|||||||
redis.address=209.222.96.50
|
redis.address=209.222.96.50
|
||||||
redis.port=6379
|
redis.port=6379
|
||||||
http.port=80
|
http.port=80
|
||||||
|
http.keystoreFile=/home/keystore.idk
|
||||||
|
http.keystorePassword=123abc
|
||||||
librato.email=cmcdonald.main@gmail.com
|
librato.email=cmcdonald.main@gmail.com
|
||||||
librato.apiToken=a818c3eca8a59d6d9cf76dc9f0d237c6aa97f257c482ce3363cf55a5431bc153
|
librato.apiToken=a818c3eca8a59d6d9cf76dc9f0d237c6aa97f257c482ce3363cf55a5431bc153
|
||||||
librato.sourceIdentifier=apiv3-dev-01
|
librato.sourceIdentifier=apiv3-dev-01
|
||||||
|
@ -28,6 +28,7 @@ import io.vertx.core.http.HttpHeaders;
|
|||||||
import io.vertx.core.http.HttpMethod;
|
import io.vertx.core.http.HttpMethod;
|
||||||
import io.vertx.core.http.HttpServer;
|
import io.vertx.core.http.HttpServer;
|
||||||
import io.vertx.core.http.HttpServerOptions;
|
import io.vertx.core.http.HttpServerOptions;
|
||||||
|
import io.vertx.core.net.JksOptions;
|
||||||
import io.vertx.ext.web.Router;
|
import io.vertx.ext.web.Router;
|
||||||
import io.vertx.ext.web.RoutingContext;
|
import io.vertx.ext.web.RoutingContext;
|
||||||
import io.vertx.ext.web.handler.BodyHandler;
|
import io.vertx.ext.web.handler.BodyHandler;
|
||||||
@ -253,14 +254,20 @@ public final class APIv3 extends AbstractVerticle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupHttpServer() {
|
private void setupHttpServer() {
|
||||||
HttpServer webServer = vertx.createHttpServer(
|
HttpServerOptions httpServerOptions = new HttpServerOptions();
|
||||||
new HttpServerOptions()
|
httpServerOptions.setCompressionSupported(true);
|
||||||
//.setSsl(true)
|
|
||||||
//.setKeyStoreOptions(new JksOptions().setPath("c:\\Users\\cmcdonald\\Desktop\\apiv3.jks").setPassword("password"))
|
|
||||||
.setCompressionSupported(true)
|
|
||||||
);
|
|
||||||
|
|
||||||
Router http = Router.router(vertx);
|
if (!config.getProperty("http.keystoreFile").isEmpty()) {
|
||||||
|
httpServerOptions.setSsl(true);
|
||||||
|
httpServerOptions.setKeyStoreOptions(
|
||||||
|
new JksOptions()
|
||||||
|
.setPassword(config.getProperty("http.keystorePassword"))
|
||||||
|
.setPath(config.getProperty("http.keystoreFile"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpServer webServer = vertx.createHttpServer(httpServerOptions);
|
||||||
|
Router http = Router.router(vertx); // we just name this http to make the route declarations easier to read
|
||||||
|
|
||||||
http.route().handler(LoggerHandler.create(LoggerFormat.TINY));
|
http.route().handler(LoggerHandler.create(LoggerFormat.TINY));
|
||||||
http.route().handler(TimeoutHandler.create(TimeUnit.SECONDS.toMillis(5)));
|
http.route().handler(TimeoutHandler.create(TimeUnit.SECONDS.toMillis(5)));
|
||||||
|
Loading…
Reference in New Issue
Block a user