Skip to content

Commit

Permalink
Properly fail when TLS reload config is invalid
Browse files Browse the repository at this point in the history
This now means that Quarkus will exit completely
even in dev-mode when the first start contains
the invalid reload configuration.
This might not be ideal, but it's far better than
the previous behavior where the application
was stuck and had to be killed with
`kill -9`

Fixes :quarkusio#43247
  • Loading branch information
geoand authored and bschuhmann committed Nov 16, 2024
1 parent 76057e0 commit 8d89eba
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,16 @@ private static CompletableFuture<HttpServer> initializeManagementInterface(Vertx
} else {
if (httpManagementServerOptions.isSsl()
&& (managementConfig.ssl.certificate.reloadPeriod.isPresent())) {
long l = TlsCertificateReloader.initCertReloadingAction(
vertx, ar.result(), httpManagementServerOptions, managementConfig.ssl, registry,
managementConfig.tlsConfigurationName);
if (l != -1) {
refresTaskIds.add(l);
try {
long l = TlsCertificateReloader.initCertReloadingAction(
vertx, ar.result(), httpManagementServerOptions, managementConfig.ssl, registry,
managementConfig.tlsConfigurationName);
if (l != -1) {
refresTaskIds.add(l);
}
} catch (IllegalArgumentException e) {
managementInterfaceFuture.completeExceptionally(e);
return;
}
}

Expand Down Expand Up @@ -1332,11 +1337,16 @@ public void handle(AsyncResult<HttpServer> event) {
}

if (https && (quarkusConfig.ssl.certificate.reloadPeriod.isPresent())) {
long l = TlsCertificateReloader.initCertReloadingAction(
vertx, httpsServer, httpsOptions, quarkusConfig.ssl, registry,
quarkusConfig.tlsConfigurationName);
if (l != -1) {
reloadingTasks.add(l);
try {
long l = TlsCertificateReloader.initCertReloadingAction(
vertx, httpsServer, httpsOptions, quarkusConfig.ssl, registry,
quarkusConfig.tlsConfigurationName);
if (l != -1) {
reloadingTasks.add(l);
}
} catch (IllegalArgumentException e) {
startFuture.fail(e);
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class TlsCertificateReloader {

private static final Logger LOGGER = Logger.getLogger(TlsCertificateReloader.class);

/**
* @throws IllegalArgumentException if any of the configuration is invalid
*/
public static long initCertReloadingAction(Vertx vertx, HttpServer server,
HttpServerOptions options, ServerSslConfig configuration,
TlsConfigurationRegistry registry, Optional<String> tlsConfigurationName) {
Expand Down

0 comments on commit 8d89eba

Please sign in to comment.