Skip to content

Commit

Permalink
feat: update out config
Browse files Browse the repository at this point in the history
  • Loading branch information
wtt40122 committed Aug 23, 2023
1 parent 520d656 commit ab8a65c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.xiaomi.mone.app.valid.AddGroup;
import com.xiaomi.mone.app.valid.UpdateGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

Expand All @@ -17,6 +18,7 @@
*/
@RestController
@RequestMapping("/hera/app/env")
@ConditionalOnProperty(name = "service.selector.property", havingValue = "outer")
public class HeraAppEnvController {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.xiaomi.mone.app.service.env.DefaultEnvIpFetch;
import com.xiaomi.mone.app.service.env.DefaultHttpEnvIpFetch;
import com.xiaomi.mone.app.service.env.EnvIpFetch;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -19,6 +20,7 @@
*/
@RestController
@RequestMapping("/test")
@ConditionalOnProperty(name = "service.selector.property", havingValue = "outer")
public class TestController {

@Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@ job_start_flag=false

rocket.mq.producer.group=hera_app
rocket.mq.hera.app.topic=hera_app_operate
rocket.mq.hera.app.tag=app_modify

hera.tpc.url=http://mi-tpc:8097

hera.operator.env.url=http://mi-operator-env:8097
rocket.mq.hera.app.tag=app_modify
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,4 @@ job_start_flag=@job_start_flag@

app.ip.fetch.type=nacos

service.selector.property=outer

hera.tpc.url=@hera.tpc.url@

hera.operator.env.url=@hera.operator.env.url@
service.selector.property=outer
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xiaomi.mone.app.service.env;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
Expand All @@ -10,6 +11,7 @@
import okhttp3.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
Expand All @@ -26,6 +28,7 @@
*/
@Service
@Slf4j
@ConditionalOnProperty(name = "service.selector.property", havingValue = "outer")
public class DefaultEnvIpFetch {

@Autowired
Expand All @@ -37,7 +40,7 @@ public class DefaultEnvIpFetch {
@Value("${app.ip.fetch.type}")
private String envApppType;

@Value("${hera.tpc.url:http://mi-tpc:8097}")
@NacosValue(value = "${hera.tpc.url}", autoRefreshed = true)
private String heraTpcUrl;

@Resource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xiaomi.mone.app.service.env;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
Expand All @@ -8,7 +9,7 @@
import com.xiaomi.mone.app.model.vo.HeraAppEnvVo;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
Expand All @@ -24,9 +25,10 @@
*/
@Service
@Slf4j
@ConditionalOnProperty(name = "service.selector.property", havingValue = "outer")
public class DefaultHttpEnvIpFetch implements EnvIpFetch {

@Value("$hera.operator.env.url:http://mi-operator-env:8097}")
@NacosValue(value = "$hera.operator.env.url}", autoRefreshed = true)
private String operatorEnvUrl;
@Resource
private OkHttpClient okHttpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.rocketmq.common.message.Message;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
Expand All @@ -39,6 +40,7 @@
*/
@Service
@Slf4j
@ConditionalOnProperty(name = "service.selector.property", havingValue = "outer")
public class HeraAppEnvServiceImpl implements HeraAppEnvService {

private final HeraAppBaseInfoMapper heraAppBaseInfoMapper;
Expand Down

0 comments on commit ab8a65c

Please sign in to comment.