소스 검색

nacos持久化

master
wangjx 3 년 전
부모
커밋
8b68b17128
2개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. +11
    -0
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java
  2. +5
    -0
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java

+ 11
- 0
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java 파일 보기

@@ -60,7 +60,18 @@ public class AppController {

@GetMapping("/briefinfos.json")
public Result<List<AppInfo>> queryAppInfos(HttpServletRequest request) {

List<AppInfo> list = new ArrayList<>(appManagement.getBriefApps());
if (list.size() == 0) {
MachineInfo machineInfo = new MachineInfo();
machineInfo.setApp("sentinel-dashboard");
machineInfo.setAppType(0);
machineInfo.setHostname("id.ssjlai.com");
machineInfo.setPort(7777);
machineInfo.setIp("172.19.42.44");
appManagement.addMachine(machineInfo);
list = new ArrayList<>(appManagement.getBriefApps());
}
Collections.sort(list, Comparator.comparing(AppInfo::getApp));
return Result.ofSuccess(list);
}


+ 5
- 0
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java 파일 보기

@@ -29,6 +29,8 @@ import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher;
import com.alibaba.csp.sentinel.dashboard.domain.Result;

import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -71,6 +73,9 @@ public class FlowControllerV2 {
@AuthAction(PrivilegeType.READ_RULE)
public Result<List<FlowRuleEntity>> apiQueryMachineRules(@RequestParam String app) {
System.out.println("FlowControllerV2 apiQueryMachineRules app is " + app);
if (StringUtils.isBlank(app)) {
app="sentinel-dashboard";
}
if (StringUtil.isEmpty(app)) {
return Result.ofFail(-1, "app can't be null or empty");
}


Loading…
취소
저장