Browse Source

🐛 钉钉告警增加配置开关

test
smallchill 5 years ago
parent
commit
c64c2c623b
  1. 9
      blade-ops/blade-admin/src/main/java/org/springblade/admin/config/AdminConfiguration.java
  2. 2
      blade-ops/blade-admin/src/main/java/org/springblade/admin/notifier/CustomNotifier.java
  3. 1
      blade-ops/blade-admin/src/main/resources/bootstrap.yml

9
blade-ops/blade-admin/src/main/java/org/springblade/admin/config/AdminConfiguration.java

@ -18,6 +18,8 @@ package org.springblade.admin.config;
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.cloud.nacos.discovery.NacosWatch;
import de.codecentric.boot.admin.server.domain.entities.InstanceRepository;
import org.springblade.admin.notifier.CustomNotifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
@ -38,4 +40,11 @@ public class AdminConfiguration {
return new NacosWatch(nacosDiscoveryProperties);
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(value = "spring.boot.admin.notify.dingtalk.enabled", havingValue = "true")
public CustomNotifier customNotifier(InstanceRepository repository) {
return new CustomNotifier(repository);
}
}

2
blade-ops/blade-admin/src/main/java/org/springblade/admin/notifier/CustomNotifier.java

@ -27,7 +27,6 @@ import de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent
import de.codecentric.boot.admin.server.notify.AbstractEventNotifier;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@ -42,7 +41,6 @@ import reactor.core.publisher.Mono;
* @author jeckxu
*/
@Slf4j
@Component
public class CustomNotifier extends AbstractEventNotifier {
/**

1
blade-ops/blade-admin/src/main/resources/bootstrap.yml

@ -19,4 +19,5 @@ spring:
- serverAddr
notify:
dingtalk:
enabled: false
webhook-token: Your DingDing Robot Token

Loading…
Cancel
Save