parent
d5d622e717
commit
ac7ec41aa5
|
@ -3,7 +3,9 @@ package com.dispose.config;
|
|||
import com.dispose.common.DisposeConfigValue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -13,13 +15,16 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* The type Device log configure.
|
||||
*
|
||||
* @author xajhu
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Component
|
||||
@RefreshScope
|
||||
@ConfigurationProperties(prefix = "device")
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class DeviceLogConfigure {
|
||||
/**
|
||||
* The Log hosts.
|
||||
|
@ -31,10 +36,14 @@ public class DeviceLogConfigure {
|
|||
*/
|
||||
@PostConstruct
|
||||
private void initGlobalValue() {
|
||||
DisposeConfigValue.LOG_HOSTS.clear();
|
||||
|
||||
for (String s : Optional.ofNullable(logHosts).orElse(new String[]{""})) {
|
||||
if (s.toLowerCase(Locale.ROOT).startsWith("http")) {
|
||||
DisposeConfigValue.LOG_HOSTS.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("Log device: {}", DisposeConfigValue.LOG_HOSTS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue