diff --git a/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java b/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java index 38e82af..1c25a2e 100644 --- a/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java +++ b/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java @@ -12,6 +12,7 @@ import java.util.Map; * @date 2023-05-17 */ public class ServiceInfo { + private Boolean enabled = true; private Integer order = 0; private List groups = new ArrayList<>(); private Integer replicas = 0; @@ -19,6 +20,14 @@ public class ServiceInfo { private Map environments = new HashMap<>(); private Map arguments = new HashMap<>(); + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public Integer getOrder() { return order; } @@ -70,7 +79,8 @@ public class ServiceInfo { @Override public String toString() { return "ServiceInfo{" + - "order=" + order + + "enabled=" + enabled + + ", order=" + order + ", groups=" + groups + ", replicas=" + replicas + ", sourceJar='" + sourceJar + '\'' + diff --git a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java index 8157bdf..0da906a 100644 --- a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java +++ b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java @@ -50,6 +50,7 @@ public class RunnerApplication implements ApplicationRunner { runtimeInfo = deployInformationProperties.getRuntime(); serviceInfoList = Lists.immutable.ofAll(deployInformationProperties.getServices().entrySet()) .collect(entry -> new ServiceInfoWrapper(entry.getKey(), entry.getValue())) + .select(ServiceInfoWrapper::getEnabled) .toSortedListBy(ServiceInfoWrapper::getOrder) .toImmutable(); hostInfoList = Lists.immutable.ofAll(SpringPropertiesEscapeHelper.escapeMapKey(deployInformationProperties.getHosts()).entrySet()) diff --git a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java index a664d41..edd0ae0 100644 --- a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java +++ b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java @@ -25,6 +25,10 @@ public class ServiceInfoWrapper { this.arguments = SpringPropertiesEscapeHelper.escapeMapKey(serviceInfo.getArguments()); } + public Boolean getEnabled() { + return serviceInfo.getEnabled(); + } + public String getName() { return name; }