feature: hippo4j config model in zookeeper config before check (#1457)

pull/1472/head
Jingliu Xiong 1 year ago committed by GitHub
parent 35cf5d82d0
commit e98b106cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,4 +94,11 @@ public interface BootstrapPropertiesInterface {
return null; return null;
} }
/**
* Get Zookeeper.
*/
default Map<String, String> getZookeeper() {
return null;
}
} }

@ -115,6 +115,35 @@ public class BeforeCheckConfiguration {
"Please check whether the [spring.dynamic.thread-pool.apollo.namespace] configuration is empty or an empty string."); "Please check whether the [spring.dynamic.thread-pool.apollo.namespace] configuration is empty or an empty string.");
} }
} }
Map<String, String> zookeeper = properties.getZookeeper();
if (MapUtil.isNotEmpty(zookeeper)) {
String zkConnectStr = zookeeper.get("zk-connect-str");
if ((StringUtil.isBlank(zkConnectStr))) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool zookeeper zk-connect-str is empty.",
"Please check whether the [spring.dynamic.thread-pool.zookeeper.zk-connect-str] configuration is empty or an empty string.");
}
String configVersion = zookeeper.get("config-version");
if ((StringUtil.isBlank(configVersion))) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool zookeeper config-version is empty.",
"Please check whether the [spring.dynamic.thread-pool.zookeeper.config-version] configuration is empty or an empty string.");
}
String rootNode = zookeeper.get("root-node");
if ((StringUtil.isBlank(rootNode))) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool zookeeper root-node is empty.",
"Please check whether the [spring.dynamic.thread-pool.zookeeper.root-node] configuration is empty or an empty string.");
}
String node = zookeeper.get("node");
if ((StringUtil.isBlank(node))) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool zookeeper node is empty.",
"Please check whether the [spring.dynamic.thread-pool.zookeeper.node] configuration is empty or an empty string.");
}
}
break; break;
} }
default: default:

Loading…
Cancel
Save