ソースを参照

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");
}


読み込み中…
キャンセル
保存