From 8dfc797dfa8731e88ea207fdaee93ceb2bd1f7cd Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sun, 25 Feb 2024 22:15:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(cli):=20=E5=A2=9E=E5=8A=A0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=E7=9A=84=E5=90=AF=E5=8A=A8=E4=B8=8E=E5=90=A6?= =?UTF-8?q?=20=E6=96=B9=E4=BE=BF=E5=85=B3=E9=97=AD=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lanyuanxiaoyao/service/cli/core/ServiceInfo.java | 12 +++++++++++- .../service/cli/runner/RunnerApplication.java | 1 + .../service/cli/runner/ServiceInfoWrapper.java | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) 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; }