I am not able to get any configuration readings outside the ".listen()" method.
public class APIVerticle extends AbstractVerticle {
@Override
public void start(Future<Void> fut) {
System.out.println("Config: " + config().getInteger("http.port")); //prints null
vertx
.createHttpServer(serverOptions)
.requestHandler(router::accept)
.listen(
config().getInteger("http.port", 8080), //gets 8082
result -> {
if (result.succeeded()) {
fut.complete();
} else {
fut.fail(result.cause());
}
}
);
}
}
my config file:
{
"http.port": 8082
}
It gets packaged as a fat jar with maven-shade-plugin
plugin.
Anybody an idea why?
That's because your AbstractVerticle receives no deployment options. It was custom made. You can see example of how it's done in Starter class:
HttpServer receives those DeploymentOptions by default. If you have options to pass to your custom verticle, pass them as second parameter of .deployVerticle