mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
refactor sentinel logic
This commit is contained in:
parent
230d845419
commit
6e0c788af2
@ -54,11 +54,6 @@ public class SentinelWebAutoConfiguration {
|
|||||||
|
|
||||||
SentinelProperties.Filter filterConfig = properties.getFilter();
|
SentinelProperties.Filter filterConfig = properties.getFilter();
|
||||||
|
|
||||||
if (null == filterConfig) {
|
|
||||||
filterConfig = new SentinelProperties.Filter();
|
|
||||||
properties.setFilter(filterConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filterConfig.getUrlPatterns() == null
|
if (filterConfig.getUrlPatterns() == null
|
||||||
|| filterConfig.getUrlPatterns().isEmpty()) {
|
|| filterConfig.getUrlPatterns().isEmpty()) {
|
||||||
List<String> defaultPatterns = new ArrayList<>();
|
List<String> defaultPatterns = new ArrayList<>();
|
||||||
|
@ -82,6 +82,15 @@ public class SentinelAutoConfiguration {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init() {
|
private void init() {
|
||||||
|
if (StringUtils.isEmpty(System.getProperty(LogBase.LOG_DIR))
|
||||||
|
&& StringUtils.hasText(properties.getLog().getDir())) {
|
||||||
|
System.setProperty(LogBase.LOG_DIR, properties.getLog().getDir());
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(System.getProperty(LogBase.LOG_NAME_USE_PID))
|
||||||
|
&& properties.getLog().isSwitchPid()) {
|
||||||
|
System.setProperty(LogBase.LOG_NAME_USE_PID,
|
||||||
|
String.valueOf(properties.getLog().isSwitchPid()));
|
||||||
|
}
|
||||||
if (StringUtils.isEmpty(System.getProperty(AppNameUtil.APP_NAME))
|
if (StringUtils.isEmpty(System.getProperty(AppNameUtil.APP_NAME))
|
||||||
&& StringUtils.hasText(projectName)) {
|
&& StringUtils.hasText(projectName)) {
|
||||||
System.setProperty(AppNameUtil.APP_NAME, projectName);
|
System.setProperty(AppNameUtil.APP_NAME, projectName);
|
||||||
@ -132,15 +141,6 @@ public class SentinelAutoConfiguration {
|
|||||||
if (StringUtils.hasText(properties.getServlet().getBlockPage())) {
|
if (StringUtils.hasText(properties.getServlet().getBlockPage())) {
|
||||||
WebServletConfig.setBlockPage(properties.getServlet().getBlockPage());
|
WebServletConfig.setBlockPage(properties.getServlet().getBlockPage());
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(System.getProperty(LogBase.LOG_DIR))
|
|
||||||
&& StringUtils.hasText(properties.getLog().getDir())) {
|
|
||||||
System.setProperty(LogBase.LOG_DIR, properties.getLog().getDir());
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(System.getProperty(LogBase.LOG_NAME_USE_PID))
|
|
||||||
&& properties.getLog().isSwitchPid()) {
|
|
||||||
System.setProperty(LogBase.LOG_NAME_USE_PID,
|
|
||||||
String.valueOf(properties.getLog().isSwitchPid()));
|
|
||||||
}
|
|
||||||
|
|
||||||
urlBlockHandlerOptional.ifPresent(WebCallbackManager::setUrlBlockHandler);
|
urlBlockHandlerOptional.ifPresent(WebCallbackManager::setUrlBlockHandler);
|
||||||
urlCleanerOptional.ifPresent(WebCallbackManager::setUrlCleaner);
|
urlCleanerOptional.ifPresent(WebCallbackManager::setUrlCleaner);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user