Skip to content

Commit

Permalink
not need access db if disabledb is true
Browse files Browse the repository at this point in the history
  • Loading branch information
qifanwang committed Sep 19, 2024
1 parent db92336 commit bd3c1f5
Show file tree
Hide file tree
Showing 25 changed files with 491 additions and 1,039 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.context.annotation.Configuration;

import java.util.*;
import java.util.stream.Collectors;

@Configuration
public class CommonConfigBean extends AbstractConfigBean {
Expand Down Expand Up @@ -68,7 +69,10 @@ public Set<String> getExtraSyncDC() {
}

public boolean disableDb() {
return getExtraSyncDC().contains(FoundationService.DEFAULT.getDataCenter());
return getExtraSyncDC().stream()
.map(String::toUpperCase)
.collect(Collectors.toSet())
.contains(FoundationService.DEFAULT.getDataCenter());
}

public Set<String> getAlertWhileList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ public class DataCenterConfigBean extends AbstractConfigBean {

public static final String KEY_BEACON_ORG_ROUTE = "beacon.org.routes";

public static final String KEY_CONSOLE_NO_DB_DOMAIN = "console.no.db.domain";

private AtomicReference<String> zkConnection = new AtomicReference<>();
private AtomicReference<String> zkNameSpace = new AtomicReference<>();

public DataCenterConfigBean() {
super(ConfigProvider.DEFAULT.getOrCreateConfig(ConfigProvider.DATA_CENTER_CONFIG_NAME));
}

public String getConsoleNoDbDomain() {
return getProperty(KEY_CONSOLE_NO_DB_DOMAIN, "");
}

public String getZkConnectionString() {
return getProperty(KEY_ZK_ADDRESS, zkConnection.get() == null ? "127.0.0.1:2181" : zkConnection.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,6 @@ public interface ConsoleConfig extends CoreConfig, CheckerConfig, AlertConfig {

Set<String> getExtraSyncDC();

String getConsoleNoDbDomain();

}
Loading

0 comments on commit bd3c1f5

Please sign in to comment.