Skip to content

Commit

Permalink
feature:check the required fields etcd when the Config mode starts(#1439
Browse files Browse the repository at this point in the history
) (#1440)
  • Loading branch information
liguangling-lgl authored Sep 2, 2023
1 parent 651cc90 commit 4fa248e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ default Boolean getBanner() {
default Map<String, String> getNacos() {
return null;
}

/**
* Get etcd.
*/
default Map<String, String> getEtcd() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ public BeforeCheckConfiguration.BeforeCheck dynamicThreadPoolBeforeCheckBean(@Au
"Please check whether the [spring.dynamic.thread-pool.nacos.data-id] configuration is empty or an empty string.");
}
}
Map<String, String> etcd = properties.getEtcd();
if (MapUtil.isNotEmpty(etcd)){
String endpoints = etcd.get("endpoints");
if ((StringUtil.isBlank(endpoints))){
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool etcd endpoints is empty.",
"Please check whether the [spring.dynamic.thread-pool.etcd.endpoints] configuration is empty or an empty string.");
}
String key = etcd.get("key");
if ((StringUtil.isBlank(key))){
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool etcd key is empty.",
"Please check whether the [spring.dynamic.thread-pool.etcd.key] configuration is empty or an empty string.");
}
}
break;
}
default:
Expand Down

0 comments on commit 4fa248e

Please sign in to comment.