Skip to content

Commit

Permalink
DBZ-8101 Ability to disable API
Browse files Browse the repository at this point in the history
  • Loading branch information
jcechace committed Sep 3, 2024
1 parent 5cf65af commit 656ea84
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.server;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigMapping(prefix = "debezium")
public interface DebeziumServerConfig {
Api api();

interface Api {
@WithDefault("true")
boolean enabled();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@

import io.debezium.engine.DebeziumEngine;
import io.debezium.server.DebeziumServer;
import io.debezium.server.DebeziumServerConfig;

@Path("/signals")
public class SignalResource {

@Inject
DebeziumServerConfig config;

@Inject
DebeziumServer server;

@POST
public Response post(@NotNull DSSignal dsSignal) {
var signaler = server.getSignaler();
if (signaler == null) {
if (signaler == null || !config.api().enabled()) {
return Response.status(Response.Status.SERVICE_UNAVAILABLE).build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: this should be eventually removed when entire config is mapped
smallrye.config.mapping.validate-unknown=false

0 comments on commit 656ea84

Please sign in to comment.