feature:check the required fields etcd when the Config mode starts(#1439) (#1440)

pull/1442/head
liguangling 1 year ago committed by GitHub
parent 651cc909e8
commit 4fa248e4ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,4 +79,11 @@ public interface BootstrapPropertiesInterface {
default Map<String, String> getNacos() { default Map<String, String> getNacos() {
return null; return null;
} }
/**
* Get etcd.
*/
default Map<String, String> getEtcd() {
return null;
}
} }

@ -91,6 +91,21 @@ public class BeforeCheckConfiguration {
"Please check whether the [spring.dynamic.thread-pool.nacos.data-id] configuration is empty or an empty string."); "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; break;
} }
default: default:

Loading…
Cancel
Save