Merge pull request #124 from SkyeBeFreeman/main

feat:modify default value of consul discovery and register.
pull/125/head
Haotian Zhang 3 years ago committed by GitHub
commit 11f043e63f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,3 +9,4 @@
- [Feat: optimize router dependency](https://github.com/Tencent/spring-cloud-tencent/pull/110)
- [Refactor: refactor transfer metadata](https://github.com/Tencent/spring-cloud-tencent/pull/111)
- [feat:add switch of polaris, discovery and register.](https://github.com/Tencent/spring-cloud-tencent/pull/122)
And [#122](https://github.com/Tencent/spring-cloud-tencent/pull/124)

@ -35,8 +35,13 @@ public class DiscoveryEnabledCondition implements Condition {
boolean isDiscoveryEnabled = Boolean
.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.polaris.discovery.enabled", "true"));
isDiscoveryEnabled |= Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.consul.discovery.enabled", "false"));
boolean isConsulDiscoveryEnabled = Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.consul.enabled", "false")) &&
Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.consul.discovery.enabled", "true"));
isDiscoveryEnabled |= isConsulDiscoveryEnabled;
return isDiscoveryEnabled;
}

@ -55,11 +55,11 @@ public class ConsulContextProperties {
private boolean enabled = false;
@Value("${spring.cloud.consul.discovery.register:#{'false'}}")
@Value("${spring.cloud.consul.discovery.register:#{'true'}}")
private boolean register;
@Value("${spring.cloud.consul.discovery.enabled:#{'false'}}")
private boolean discoveryEnabled = false;
@Value("${spring.cloud.consul.discovery.enabled:#{'true'}}")
private boolean discoveryEnabled;
@Value("${spring.cloud.consul.discovery.instance-id:}")
private String instanceId;

@ -33,8 +33,13 @@ public class RegisterEnabledCondition implements Condition {
AnnotatedTypeMetadata annotatedTypeMetadata) {
boolean isRegisterEnabled = Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.polaris.discovery.register", "true"));
isRegisterEnabled |= Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.consul.discovery.register", "false"));
boolean isConsulRegisterEnabled = Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.consul.enabled", "false")) &&
Boolean.parseBoolean(conditionContext.getEnvironment()
.getProperty("spring.cloud.consul.discovery.register", "true"));
isRegisterEnabled |= isConsulRegisterEnabled;
return isRegisterEnabled;
}

Loading…
Cancel
Save