mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
适配eureka
This commit is contained in:
@@ -6,10 +6,7 @@ package com.gitee.sop.gateway.config;
|
||||
* 注意:下面两个只能使用一个
|
||||
*/
|
||||
|
||||
import com.gitee.sop.gateway.loadbalancer.SopPropertiesFactory;
|
||||
import com.gitee.sop.gatewaycommon.zuul.configuration.AlipayZuulConfiguration;
|
||||
import org.springframework.cloud.netflix.ribbon.PropertiesFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
@@ -19,11 +16,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class ZuulConfig extends AlipayZuulConfiguration {
|
||||
|
||||
@Bean
|
||||
PropertiesFactory propertiesFactory() {
|
||||
return new SopPropertiesFactory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.gitee.sop.gateway.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.gitee.sop.gateway.manager.ChannelMsgProcessor;
|
||||
import com.gitee.sop.gateway.manager.DbEnvGrayManager;
|
||||
import com.gitee.sop.gateway.manager.DbIPBlacklistManager;
|
||||
import com.gitee.sop.gateway.manager.DbIsvManager;
|
||||
@@ -11,6 +10,7 @@ import com.gitee.sop.gateway.manager.DbRouteConfigManager;
|
||||
import com.gitee.sop.gatewaycommon.bean.GatewayPushDTO;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.bean.SpringContext;
|
||||
import com.gitee.sop.gatewaycommon.manager.ChannelMsgProcessor;
|
||||
import com.gitee.sop.gatewaycommon.util.RequestUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@@ -1,60 +0,0 @@
|
||||
package com.gitee.sop.gateway.loadbalancer;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.SpringContext;
|
||||
import com.gitee.sop.gatewaycommon.zuul.loadbalancer.BaseServerChooser;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
import org.springframework.cloud.alibaba.nacos.ribbon.NacosServer;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 预发布、灰度环境选择,参考自:https://segmentfault.com/a/1190000017412946
|
||||
*
|
||||
* @author tanghc
|
||||
*/
|
||||
public class EnvironmentServerChooser extends BaseServerChooser {
|
||||
|
||||
private static final String MEDATA_KEY_ENV = "env";
|
||||
private static final String ENV_PRE_VALUE = "pre";
|
||||
private static final String ENV_GRAY_VALUE = "gray";
|
||||
|
||||
/**
|
||||
* 预发布机器域名
|
||||
*/
|
||||
private static final String PRE_DOMAIN = "localhost";
|
||||
|
||||
@Override
|
||||
protected boolean isPreServer(Server server) {
|
||||
String env = getEnvValue(server);
|
||||
return ENV_PRE_VALUE.equals(env);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isGrayServer(Server server) {
|
||||
String env = getEnvValue(server);
|
||||
return ENV_GRAY_VALUE.equals(env);
|
||||
}
|
||||
|
||||
private String getEnvValue(Server server) {
|
||||
// eureka存储的metadata
|
||||
Map<String, String> metadata = ((NacosServer) server).getMetadata();
|
||||
return metadata.get(MEDATA_KEY_ENV);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过判断hostname来确定是否是预发布请求,可修改此方法实现自己想要的
|
||||
*
|
||||
* @param request request
|
||||
* @return 返回true:可以进入到预发环境
|
||||
*/
|
||||
@Override
|
||||
protected boolean canVisitPre(Server server, HttpServletRequest request) {
|
||||
String serverName = request.getServerName();
|
||||
String domain = SpringContext.getBean(Environment.class).getProperty("pre.domain", PRE_DOMAIN);
|
||||
return domain.equals(serverName);
|
||||
}
|
||||
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
package com.gitee.sop.gateway.loadbalancer;
|
||||
|
||||
import com.netflix.loadbalancer.IRule;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.netflix.ribbon.PropertiesFactory;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* 自定义PropertiesFactory,用来动态添加LoadBalance规则
|
||||
* @author tanghc
|
||||
*/
|
||||
public class SopPropertiesFactory extends PropertiesFactory {
|
||||
|
||||
/**
|
||||
* 可在配置文件中设置<code>zuul.custom-rule-classname=com.xx.ClassName</code>指定负载均衡规则类
|
||||
* 默认使用com.gitee.sop.gateway.loadbalancer.PreEnvironmentServerChooser
|
||||
*/
|
||||
private static final String PROPERTIES_KEY = "zuul.custom-rule-classname";
|
||||
|
||||
private static final String CUSTOM_RULE_CLASSNAME = EnvironmentServerChooser.class.getName();
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
/**
|
||||
* 配置文件配置:<serviceId>.ribbon.NFLoadBalancerRuleClassName=com.gitee.sop.gateway.loadbalancer.EnvironmentServerChooser
|
||||
* @param clazz
|
||||
* @param name serviceId
|
||||
* @return 返回class全限定名
|
||||
*/
|
||||
@Override
|
||||
public String getClassName(Class clazz, String name) {
|
||||
if (clazz == IRule.class) {
|
||||
return this.environment.getProperty(PROPERTIES_KEY, CUSTOM_RULE_CLASSNAME);
|
||||
} else {
|
||||
return super.getClassName(clazz, name);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
|
||||
/**
|
||||
* @author tanghc
|
||||
*/
|
||||
public interface ChannelMsgProcessor {
|
||||
void process(ChannelMsg channelMsg);
|
||||
}
|
@@ -1,16 +1,11 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.AbstractListener;
|
||||
import com.gitee.fastmybatis.core.query.Query;
|
||||
import com.gitee.sop.gateway.entity.ConfigGray;
|
||||
import com.gitee.sop.gateway.entity.ConfigGrayInstance;
|
||||
import com.gitee.sop.gateway.mapper.ConfigGrayInstanceMapper;
|
||||
import com.gitee.sop.gateway.mapper.ConfigGrayMapper;
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.bean.ServiceGrayDefinition;
|
||||
import com.gitee.sop.gatewaycommon.manager.DefaultEnvGrayManager;
|
||||
import com.gitee.sop.gatewaycommon.zuul.loadbalancer.ServiceGrayConfig;
|
||||
@@ -20,7 +15,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -36,7 +30,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DbEnvGrayManager extends DefaultEnvGrayManager implements ChannelMsgProcessor {
|
||||
public class DbEnvGrayManager extends DefaultEnvGrayManager {
|
||||
|
||||
private static final int STATUS_ENABLE = 1;
|
||||
|
||||
@@ -49,9 +43,6 @@ public class DbEnvGrayManager extends DefaultEnvGrayManager implements ChannelMs
|
||||
@Autowired
|
||||
private ConfigGrayInstanceMapper configGrayInstanceMapper;
|
||||
|
||||
@NacosInjected
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
@@ -116,15 +107,5 @@ public class DbEnvGrayManager extends DefaultEnvGrayManager implements ChannelMs
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void after() throws Exception {
|
||||
configService.addListener(NacosConfigs.DATA_ID_GRAY, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
ChannelMsg channelMsg = JSON.parseObject(configInfo, ChannelMsg.class);
|
||||
process(channelMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,19 +1,13 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.AbstractListener;
|
||||
import com.gitee.sop.gateway.mapper.IPBlacklistMapper;
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.manager.DefaultIPBlacklistManager;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,14 +17,11 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DbIPBlacklistManager extends DefaultIPBlacklistManager implements ChannelMsgProcessor {
|
||||
public class DbIPBlacklistManager extends DefaultIPBlacklistManager {
|
||||
|
||||
@Autowired
|
||||
private IPBlacklistMapper ipBlacklistMapper;
|
||||
|
||||
@NacosInjected
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
List<String> ipList = ipBlacklistMapper.listAllIP();
|
||||
@@ -56,16 +47,6 @@ public class DbIPBlacklistManager extends DefaultIPBlacklistManager implements C
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void after() throws Exception {
|
||||
configService.addListener(NacosConfigs.DATA_ID_IP_BLACKLIST, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
ChannelMsg channelMsg = JSON.parseObject(configInfo, ChannelMsg.class);
|
||||
process(channelMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class IPDto {
|
||||
|
@@ -1,22 +1,16 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.AbstractListener;
|
||||
import com.gitee.sop.gateway.entity.IsvDetailDTO;
|
||||
import com.gitee.sop.gateway.mapper.IsvInfoMapper;
|
||||
import com.gitee.sop.gatewaycommon.bean.ApiConfig;
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
import com.gitee.sop.gatewaycommon.bean.IsvDefinition;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.secret.CacheIsvManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -24,14 +18,15 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DbIsvManager extends CacheIsvManager implements ChannelMsgProcessor{
|
||||
public class DbIsvManager extends CacheIsvManager {
|
||||
|
||||
public DbIsvManager() {
|
||||
ApiConfig.getInstance().setIsvManager(this);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IsvInfoMapper isvInfoMapper;
|
||||
|
||||
@NacosInjected
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
List<IsvDetailDTO> isvInfoList = isvInfoMapper.listIsvDetail();
|
||||
@@ -60,17 +55,4 @@ public class DbIsvManager extends CacheIsvManager implements ChannelMsgProcessor
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void after() throws Exception {
|
||||
ApiConfig.getInstance().setIsvManager(this);
|
||||
|
||||
configService.addListener(NacosConfigs.DATA_ID_ISV, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
ChannelMsg channelMsg = JSON.parseObject(configInfo, ChannelMsg.class);
|
||||
process(channelMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,6 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.AbstractListener;
|
||||
import com.gitee.fastmybatis.core.query.Query;
|
||||
import com.gitee.sop.gateway.entity.IsvInfo;
|
||||
import com.gitee.sop.gateway.entity.PermIsvRole;
|
||||
@@ -13,7 +10,6 @@ import com.gitee.sop.gateway.mapper.PermIsvRoleMapper;
|
||||
import com.gitee.sop.gateway.mapper.PermRolePermissionMapper;
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
import com.gitee.sop.gatewaycommon.bean.IsvRoutePermission;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.manager.DefaultIsvRoutePermissionManager;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,7 +19,6 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -40,7 +35,7 @@ import static java.util.stream.Collectors.toList;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DbIsvRoutePermissionManager extends DefaultIsvRoutePermissionManager implements ChannelMsgProcessor {
|
||||
public class DbIsvRoutePermissionManager extends DefaultIsvRoutePermissionManager {
|
||||
|
||||
@Autowired
|
||||
Environment environment;
|
||||
@@ -54,8 +49,6 @@ public class DbIsvRoutePermissionManager extends DefaultIsvRoutePermissionManage
|
||||
@Autowired
|
||||
IsvInfoMapper isvInfoMapper;
|
||||
|
||||
@NacosInjected
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
@@ -147,17 +140,6 @@ public class DbIsvRoutePermissionManager extends DefaultIsvRoutePermissionManage
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void after() throws Exception {
|
||||
configService.addListener(NacosConfigs.DATA_ID_ROUTE_PERMISSION, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
ChannelMsg channelMsg = JSON.parseObject(configInfo, ChannelMsg.class);
|
||||
process(channelMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
static class IsvRole {
|
||||
|
@@ -1,14 +1,9 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.AbstractListener;
|
||||
import com.gitee.fastmybatis.core.query.Query;
|
||||
import com.gitee.sop.gateway.mapper.ConfigLimitMapper;
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
import com.gitee.sop.gatewaycommon.bean.ConfigLimitDto;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.manager.DefaultLimitConfigManager;
|
||||
import com.gitee.sop.gatewaycommon.util.MyBeanUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -16,15 +11,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 限流配置管理
|
||||
* @author tanghc
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DbLimitConfigManager extends DefaultLimitConfigManager implements ChannelMsgProcessor {
|
||||
public class DbLimitConfigManager extends DefaultLimitConfigManager {
|
||||
|
||||
@Autowired
|
||||
ConfigLimitMapper configLimitMapper;
|
||||
@@ -32,9 +25,6 @@ public class DbLimitConfigManager extends DefaultLimitConfigManager implements C
|
||||
@Autowired
|
||||
Environment environment;
|
||||
|
||||
@NacosInjected
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
Query query = new Query();
|
||||
@@ -65,15 +55,5 @@ public class DbLimitConfigManager extends DefaultLimitConfigManager implements C
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void after() throws Exception {
|
||||
configService.addListener(NacosConfigs.DATA_ID_LIMIT_CONFIG, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
ChannelMsg channelMsg = JSON.parseObject(configInfo, ChannelMsg.class);
|
||||
process(channelMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,14 +1,9 @@
|
||||
package com.gitee.sop.gateway.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.AbstractListener;
|
||||
import com.gitee.fastmybatis.core.query.Query;
|
||||
import com.gitee.sop.gateway.mapper.ConfigRouteBaseMapper;
|
||||
import com.gitee.sop.gateway.mapper.ConfigRouteLimitMapper;
|
||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
|
||||
import com.gitee.sop.gatewaycommon.bean.RouteConfig;
|
||||
import com.gitee.sop.gatewaycommon.bean.RouteDefinition;
|
||||
import com.gitee.sop.gatewaycommon.bean.TargetRoute;
|
||||
@@ -19,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
@@ -27,7 +21,7 @@ import java.util.Collection;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DbRouteConfigManager extends DefaultRouteConfigManager implements ChannelMsgProcessor {
|
||||
public class DbRouteConfigManager extends DefaultRouteConfigManager {
|
||||
|
||||
@Autowired
|
||||
ConfigRouteBaseMapper configRouteBaseMapper;
|
||||
@@ -38,9 +32,6 @@ public class DbRouteConfigManager extends DefaultRouteConfigManager implements C
|
||||
@Autowired
|
||||
Environment environment;
|
||||
|
||||
@NacosInjected
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
loadAllRoute();
|
||||
@@ -88,14 +79,4 @@ public class DbRouteConfigManager extends DefaultRouteConfigManager implements C
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void after() throws Exception {
|
||||
configService.addListener(NacosConfigs.DATA_ID_ROUTE_CONFIG, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
ChannelMsg channelMsg = JSON.parseObject(configInfo, ChannelMsg.class);
|
||||
process(channelMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
server.port=8081
|
||||
# 固定不变
|
||||
spring.application.name=api-gateway
|
||||
|
||||
# ------- 需要改的配置 -------
|
||||
@@ -17,6 +18,9 @@ zipkin.url=http://127.0.0.1:9411/
|
||||
pre.domain=localhost
|
||||
# ------- 需要改的配置end -------
|
||||
|
||||
# eureka注册中心
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
|
||||
|
||||
# 入口地址,不用改,默认是/zuul
|
||||
zuul.servlet-path=/api
|
||||
# 禁用默认的过滤器,不能删,不用改
|
||||
@@ -36,8 +40,8 @@ ribbon.ReadTimeout=2000
|
||||
ribbon.OkToRetryOnAllOperations=false
|
||||
|
||||
# nacos cloud配置
|
||||
spring.cloud.nacos.discovery.server-addr=${nacos.url}
|
||||
nacos.config.server-addr=${nacos.url}
|
||||
#spring.cloud.nacos.discovery.server-addr=${nacos.url}
|
||||
#nacos.config.server-addr=${nacos.url}
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://${mysql.host}/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
|
||||
|
Reference in New Issue
Block a user