Commit 0c4d1811 by 黄超华

过滤器开发

1 parent 52e61085
# framework-archetype
一、项目结构说明:
└─src
├─main
├─java
├─com.glsx.plat.gateway.common 公共方法-常量等
├─com.glsx.plat.gateway.config 系统配置
├─com.glsx.plat.gateway.exception 自定义异常处理
├─com.glsx.plat.gateway.filter 网关核心过滤器
├─com.glsx.plat.gateway.model 实体类
├─com.glsx.plat.gateway.utils 工具包
└─com.glsx.plat.gateway.GatewayApplication.java 程序入口
├─resources 资源文件目录
├─bootstrap.properties 应用配置文件
└─logback.xml 日志配置文件
└─webapp web前端文件目录
└─WEB-INF
└─bin shell脚本文件(包含启动、停止、重启等)
└─test 测试目录
├─java
└─com.glsx.plat.gateway 测试代码
└─pom.xml pom文件
二、使用说明:
1、每个调用API服务的接口,都需要先配置调用方信息,包括appKey、secret等
2、每个请求的header中需包含几个关键字段:
2.1> appKey:调用方身份标识
2.2> timestamp:请求时间戳,精确到毫秒
2.3> sign:签名,规则如下:
2.3.1> 参数排序:按照字母先后顺序,将参数进行排序,例如:将foo=1,bar=2,baz=3 排序为bar=2,baz=3,foo=1
2.3.2> 参数名和参数值链接后,得到拼装字符串bar2baz3foo1
2.3.3> 拼接上header中的timestamp和调用方的secret,得到 bar2baz3foo1 {timestamp} {secret}
2.3.4> 将上个步骤得到的字符串进行MD5加密,再转成小写就得到了签名sign
3、接口调用需经过网关层面的层层认证通过后,才会路由调用到下游方,下面是几个关键的过滤器
3.1> RecordServiceFilter:根据调用方appKey识别身份信息,校验timestamp合法性
3.2> IPCheckGlobalFilter:验证调用方IP是否在白名单内
3.3> JWTAuthGlobalFilter:验证身份认证token是否合法有效
3.4> CheckSignGlobalFilter:验证调用方的参数签名是否合法
4、
......@@ -6,6 +6,8 @@ public interface Constants {
String SERVICE_NAME = "SERVICE-NAME";
String GATEWAY_SERVICE_NAME = "GATEWAY_SERVICE";
//操作日志过滤器执行顺序,值越小优先级越高
int LOGGING_GLOBAL_FILTER_ORDER = Ordered.HIGHEST_PRECEDENCE;
//记录服务名
......
......@@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
@EnableConfigurationProperties(ApiGatewayRetryConfig.class)
@EnableConfigurationProperties({ApiGatewayRetryConfig.class, ApiGatewayServiceConfig.class})
//@LoadBalancerClients(defaultConfiguration = CommonLoadBalancerConfig.class)
public class ApiGatewayConfig {
......
package com.glsx.plat.gateway.config;
import com.glsx.plat.gateway.model.GatewayService;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author huangch
* @version V1.0
* @Title: ApiGatewayConsumerConfig
* @Description:
* @Company: Didihu.com.cn
* @Date 2023/4/6 10:36
*/
@RefreshScope
@ConfigurationProperties(prefix = "gateway")
public class ApiGatewayServiceConfig {
private Map<String, GatewayService> services;
public void setServices(Map<String, GatewayService> services) {
Map<String, GatewayService> newMap = new ConcurrentHashMap<>();
for(Map.Entry<String, GatewayService> entry : services.entrySet()){
GatewayService gatewayService = entry.getValue();
gatewayService.setName(entry.getKey());
newMap.put(gatewayService.getAppKey(), gatewayService);
}
this.services = newMap;
}
public GatewayService getServiceByAppKey(String appKey){
return this.services.get(appKey);
}
}
......@@ -5,12 +5,16 @@ import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.common.utils.SignUtils;
import com.glsx.plat.core.web.R;
import com.glsx.plat.gateway.common.Constants;
import com.glsx.plat.gateway.config.ApiGatewayServiceConfig;
import com.glsx.plat.gateway.model.GatewayService;
import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.core.ResolvableType;
import org.springframework.core.env.Environment;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.http.HttpHeaders;
......@@ -39,14 +43,11 @@ import java.util.*;
* @author payu
*/
@Slf4j
//@Component
@Component
public class CheckSignGlobalFilter implements GlobalFilter, Ordered {
@Value("${gateway.sign.switch:off}")
private String signSwitch;
@Value("${gateway.sign.secret}")
private String signSecret;
@Autowired
private Environment env;
//保存HttpMessageReader
private static final List<HttpMessageReader<?>> MESSAGE_READERS = HandlerStrategies.withDefaults().messageReaders();
......@@ -54,15 +55,24 @@ public class CheckSignGlobalFilter implements GlobalFilter, Ordered {
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest request = exchange.getRequest();
log.info("访问地址:{}", request.getURI().toString());
// 请求参数上的url地址
log.info("访问地址:{}", request.getURI());
if (!env.getProperty("gateway.sign.switch", Boolean.class, false)){
return chain.filter(exchange);
}
GatewayService gatewayService = exchange.getAttribute(Constants.GATEWAY_SERVICE_NAME);
//调用方是否开启鉴权
if(!gatewayService.getCheckSign()){
return chain.filter(exchange);
}
Map<String, String> params = new HashMap<>();
request.getQueryParams().forEach((key, items) -> {
params.put(key, items.get(0));
});
String sign = request.getHeaders().getFirst("sign");
params.put("sign", sign);
if (HttpMethod.GET.name().equals(request.getMethodValue())) {
return this.checkSign(params, chain, exchange);
return this.checkSign(params, gatewayService.getSecret(), chain, exchange);
} else if (HttpMethod.POST.name().equals(request.getMethodValue())) {
return DataBufferUtils.join(exchange.getRequest().getBody()).flatMap(dataBuffer -> {
DataBufferUtils.retain(dataBuffer);
......@@ -75,28 +85,26 @@ public class CheckSignGlobalFilter implements GlobalFilter, Ordered {
};
final ServerWebExchange mutatedExchange = exchange.mutate().request(mutatedRequest).build();
return cacheBody(mutatedExchange, chain, params);
return cacheBody(params, gatewayService.getSecret(), chain, mutatedExchange);
});
}
return chain.filter(exchange);
}
/***
 * 验证签名
 * @author Lance lance_lan_2016@163.com
 * @date 2020-01-07 09:57
 * @param params
 * @param chain
 * @param exchange
 * @return reactor.core.publisher.Mono<java.lang.Void>
 *
 * */
private Mono<Void> checkSign(Map<String, String> params, GatewayFilterChain chain, ServerWebExchange exchange) {
if (!"on".equalsIgnoreCase(signSwitch)) return chain.filter(exchange);
/**
* 验证签名
* @param params:
* @param secret:
* @param chain:
* @param exchange:
* @return reactor.core.publisher.Mono<java.lang.Void>
* @author huangch
* @date 2023/4/6 15:36
*/
private Mono<Void> checkSign(Map<String, String> params, String secret, GatewayFilterChain chain, ServerWebExchange exchange) {
log.info("校验参数集合:" + params);
if (!SignUtils.checkSign(params, signSecret)) {
if (!SignUtils.checkSign(params, secret)) {
// 返回json格式
exchange.getResponse().setStatusCode(HttpStatus.OK);
exchange.getResponse().getHeaders().add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
......@@ -106,7 +114,7 @@ public class CheckSignGlobalFilter implements GlobalFilter, Ordered {
}
@SuppressWarnings("unchecked")
private Mono<Void> cacheBody(ServerWebExchange exchange, GatewayFilterChain chain, Map<String, String> params) {
private Mono<Void> cacheBody(Map<String, String> params, String secret, GatewayFilterChain chain, ServerWebExchange exchange) {
final HttpHeaders headers = exchange.getRequest().getHeaders();
if (headers.getContentLength() == 0) {
return chain.filter(exchange);
......@@ -176,7 +184,7 @@ public class CheckSignGlobalFilter implements GlobalFilter, Ordered {
}
}
}
return this.checkSign(params, chain, exchange);
return this.checkSign(params, secret, chain, exchange);
});
}
......
//package com.glsx.plat.gateway.filter;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.glsx.plat.common.utils.SignUtils;
//import com.glsx.plat.core.web.R;
//import com.glsx.plat.gateway.common.Constants;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.cloud.gateway.filter.GatewayFilterChain;
//import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.core.Ordered;
//import org.springframework.core.ResolvableType;
//import org.springframework.core.io.buffer.DataBuffer;
//import org.springframework.core.io.buffer.DataBufferUtils;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpMethod;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.codec.HttpMessageReader;
//import org.springframework.http.codec.multipart.Part;
//import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.http.server.reactive.ServerHttpRequestDecorator;
//import org.springframework.util.MultiValueMap;
//import org.springframework.web.reactive.function.server.HandlerStrategies;
//import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Flux;
//import reactor.core.publisher.Mono;
//
//import java.io.UnsupportedEncodingException;
//import java.lang.reflect.Field;
//import java.net.URLDecoder;
//import java.util.*;
//
///**
// * 验签
// *
// * @author payu
// */
//@Slf4j
////@Component
//public class CheckSignGlobalFilterBak implements GlobalFilter, Ordered {
//
// @Value("${gateway.sign.switch:off}")
// private String signSwitch;
//
// @Value("${gateway.sign.secret}")
// private String signSecret;
//
// //保存HttpMessageReader
// private static final List<HttpMessageReader<?>> MESSAGE_READERS = HandlerStrategies.withDefaults().messageReaders();
//
// @Override
// public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
// ServerHttpRequest request = exchange.getRequest();
// log.info("访问地址:{}", request.getURI().toString());
//
// // 请求参数上的url地址
// Map<String, String> params = new HashMap<>();
// request.getQueryParams().forEach((key, items) -> {
// params.put(key, items.get(0));
// });
// if (HttpMethod.GET.name().equals(request.getMethodValue())) {
// return this.checkSign(params, chain, exchange);
// } else if (HttpMethod.POST.name().equals(request.getMethodValue())) {
// return DataBufferUtils.join(exchange.getRequest().getBody()).flatMap(dataBuffer -> {
// DataBufferUtils.retain(dataBuffer);
// final Flux<DataBuffer> cachedFlux = Flux.defer(() -> Flux.just(dataBuffer.slice(0, dataBuffer.readableByteCount())));
// final ServerHttpRequest mutatedRequest = new ServerHttpRequestDecorator(exchange.getRequest()) {
// @Override
// public Flux<DataBuffer> getBody() {
// return cachedFlux;
// }
// };
// final ServerWebExchange mutatedExchange = exchange.mutate().request(mutatedRequest).build();
//
// return cacheBody(mutatedExchange, chain, params);
// });
//
// }
// return chain.filter(exchange);
// }
//
// /***
//  * 验证签名
//  * @author Lance lance_lan_2016@163.com
//  * @date 2020-01-07 09:57
//  * @param params
//  * @param chain
//  * @param exchange
//  * @return reactor.core.publisher.Mono<java.lang.Void>
//  *
//  * */
// private Mono<Void> checkSign(Map<String, String> params, GatewayFilterChain chain, ServerWebExchange exchange) {
// if (!"on".equalsIgnoreCase(signSwitch)) return chain.filter(exchange);
//
// log.info("校验参数集合:" + params);
// if (!SignUtils.checkSign(params, signSecret)) {
// // 返回json格式
// exchange.getResponse().setStatusCode(HttpStatus.OK);
// exchange.getResponse().getHeaders().add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
// return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "签名验证失败")).getBytes())));
// }
// return chain.filter(exchange);
// }
//
// @SuppressWarnings("unchecked")
// private Mono<Void> cacheBody(ServerWebExchange exchange, GatewayFilterChain chain, Map<String, String> params) {
// final HttpHeaders headers = exchange.getRequest().getHeaders();
// if (headers.getContentLength() == 0) {
// return chain.filter(exchange);
// }
// final ResolvableType resolvableType;
// if (MediaType.MULTIPART_FORM_DATA.isCompatibleWith(headers.getContentType())) {
// resolvableType = ResolvableType.forClassWithGenerics(MultiValueMap.class, String.class, Part.class);
// } else if (MediaType.APPLICATION_JSON.isCompatibleWith(headers.getContentType()) || MediaType.APPLICATION_JSON_UTF8.isCompatibleWith(headers.getContentType())) {
// resolvableType = ResolvableType.forClass(JSONObject.class);//必须是Object不能是Array,带sign字段
// } else {
// resolvableType = ResolvableType.forClass(String.class);
// }
//
// return MESSAGE_READERS.stream().filter(reader -> reader.canRead(resolvableType,
// exchange.getRequest().getHeaders().getContentType())).findFirst()
// .orElseThrow(() -> new IllegalStateException("no suitable HttpMessageReader.")).readMono(resolvableType,
// exchange.getRequest(), Collections.emptyMap()).flatMap(resolvedBody -> {
// if (resolvedBody instanceof MultiValueMap) {
// @SuppressWarnings("rawtypes")
// MultiValueMap<String, Object> map = (MultiValueMap) resolvedBody;
// map.keySet().forEach(key -> {
// // SynchronossPartHttpMessageReader
// Object obj = map.get(key);
// List<Object> list = (List<Object>) obj;
// for (Object object : list) {
// if (object.getClass().toString().equals("class org.springframework.http.codec.multipart.SynchronossPartHttpMessageReader$SynchronossFilePart")) {
// continue;
// }
// Field[] fields = object.getClass().getDeclaredFields();
// try {
// for (Field field : fields) {
// field.setAccessible(true);
// params.put(key, field.get(object) + "");
// }
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// log.info(e.getLocalizedMessage());
// }
// }
// });
// } else if (resolvedBody instanceof JSONObject) {
// @SuppressWarnings("rawtypes")
// JSONObject bodyObj = (JSONObject) resolvedBody;
//
// Iterator iter = bodyObj.entrySet().iterator();
// while (iter.hasNext()) {
// Map.Entry entry = (Map.Entry) iter.next();
// params.put(entry.getKey().toString(), String.valueOf(entry.getValue()));
// }
// } else {
// if (null != resolvedBody) {
// String path = null;
// try {
// path = URLDecoder.decode(resolvedBody.toString(), "UTF-8");
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// log.error(e.getLocalizedMessage());
// }
// if (null != path) {
// String items[] = path.split("&");
// for (String item : items) {
// String subItems[] = item.split("=");
// if (subItems.length == 2) {
// params.put(subItems[0], subItems[1]);
// }
// }
// }
// }
// }
// return this.checkSign(params, chain, exchange);
// });
// }
//
// @Override
// public int getOrder() {
// return Constants.CHECK_SIGN_GLOBAL_FILTER_ORDER;
// }
//
//}
......@@ -3,21 +3,23 @@ package com.glsx.plat.gateway.filter;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.core.web.R;
import com.glsx.plat.gateway.common.Constants;
import com.glsx.plat.gateway.config.ApiGatewayServiceConfig;
import com.glsx.plat.gateway.model.GatewayService;
import com.glsx.plat.gateway.utils.GatewayIpUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.core.Ordered;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import java.util.Arrays;
import java.util.Map;
import java.util.List;
/**
* @author huangch
......@@ -32,28 +34,29 @@ import java.util.Map;
@RefreshScope
public class IPCheckGlobalFilter implements GlobalFilter, Ordered {
private static final String IP_AUTH_KEY_NAME = "ip-auth";
private static final String WHITE_IP_LIST_KEY_NAME = "white-ips";
@Autowired
private ApiGatewayServiceConfig consumerConfig;
private static final String APP_KEY = "appKey";
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//获取路由对象和元数据
Route route = exchange.getAttribute(ServerWebExchangeUtils.GATEWAY_ROUTE_ATTR);
Map<String, Object> metadata = route.getMetadata();
ServerHttpRequest request = exchange.getRequest();
GatewayService gatewayService = exchange.getAttribute(Constants.GATEWAY_SERVICE_NAME);
//判断鉴权开关是否打开
Object ipAuthSwitch = metadata.get(IP_AUTH_KEY_NAME);
if(ipAuthSwitch == null || Boolean.parseBoolean(ipAuthSwitch.toString()) == false){
if(!gatewayService.getIpAuth()){
return chain.filter(exchange);
}
//获取请求方真实IP
ServerHttpRequest request = exchange.getRequest();
String requestIp = GatewayIpUtils.getIpAddr(request);
//判断请求方IP是否在白名单内
String ips = metadata.get(WHITE_IP_LIST_KEY_NAME).toString();
if(Arrays.asList(ips.split(",")).contains(requestIp)){
List<String> whiteIps = Arrays.asList(gatewayService.getWhiteIps().split(","));
if(whiteIps.contains(requestIp)){
return chain.filter(exchange);
}
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "IP NO IN WHITE LIST")).getBytes())));
ServerHttpResponse response = exchange.getResponse();
response.setStatusCode(HttpStatus.FORBIDDEN);
return response.writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "IP NO IN WHITE LIST")).getBytes())));
}
@Override
......
package com.glsx.plat.gateway.filter;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.core.web.R;
import com.glsx.plat.gateway.common.Constants;
import com.glsx.plat.gateway.config.ApiGatewayServiceConfig;
import com.glsx.plat.gateway.model.GatewayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.core.Ordered;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpRequestDecorator;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
@Slf4j
@Component
public class RecordServiceNameFilter implements GlobalFilter, Ordered {
public class RecordServiceFilter implements GlobalFilter, Ordered {
@Autowired
private ApiGatewayServiceConfig consumerConfig;
@Autowired
private Environment env;
private static final String APP_KEY = "appKey";
private static final String TIMESTAMP = "timestamp";
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest request = exchange.getRequest();
//校验请求的时间戳
String timestamp = request.getHeaders().getFirst(TIMESTAMP);
if(StringUtils.isEmpty(timestamp)){
log.warn("缺少请求参数timestamp");
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "Time Error.")).getBytes())));
}
long timeout = env.getProperty("gateway.sign.timeout", Long.class, 5 * 60 * 1000L);
long diff = System.currentTimeMillis() - Long.parseLong(timestamp);
if(diff < 0 || diff > timeout){
log.warn("请求参数timestamp不在系统允许的范围内");
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "Time Error.")).getBytes())));
}
//校验请求头是否携带appKey参数
String appKey = request.getHeaders().getFirst(APP_KEY);
if(StringUtils.isEmpty(appKey)){
log.warn("缺少请求参数appKey");
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "Sign Error.")).getBytes())));
}
//appKey是否正确
GatewayService gatewayService = consumerConfig.getServiceByAppKey(appKey);
if(gatewayService == null){
log.warn("appKey对应的调用方不存在");
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(JSON.toJSONString(R.error(HttpStatus.FORBIDDEN.value(), "Sign Error.")).getBytes())));
}
exchange.getAttributes().put(Constants.GATEWAY_SERVICE_NAME, gatewayService);
Route route = exchange.getAttribute(ServerWebExchangeUtils.GATEWAY_ROUTE_ATTR);
String host = route.getUri().getHost();
return chain.filter(exchange.mutate().request(new ServerHttpRequestDecorator(exchange.getRequest()) {
......
package com.glsx.plat.gateway.model;
import lombok.Data;
/**
* @author huangch
* @version V1.0
* @Title: Consumer
* @Description:
* @Company: Didihu.com.cn
* @Date 2023/4/6 10:40
*/
@Data
public class GatewayService {
/**
* 调用方英文名称
*/
private String name;
/**
* 调用方中文名称
*/
private String remark;
/**
* appKey
*/
private String appKey;
/**
* secret:秘钥
*/
private String secret;
/**
* 是否对调用方开启IP鉴权
*/
private Boolean ipAuth;
/**
* 调用方IP白名单
*/
private String whiteIps;
/**
* 是否校验调用方的签名
*/
private Boolean checkSign;
}
......@@ -10,9 +10,10 @@ spring.cloud.nacos.config.server-addr=192.168.0.63:8868
spring.cloud.nacos.config.group=ARCHETYPE_GROUP
spring.cloud.nacos.config.prefix=${spring.application.name}
spring.profiles.active=dev
spring.cloud.nacos.config.file-extension=properties
#spring.cloud.nacos.config.file-extension=properties
spring.cloud.nacos.config.file-extension=yaml
#share config
spring.cloud.nacos.config.shared-configs[0].data-id=rest-microservice-share.properties
spring.cloud.nacos.config.shared-configs[0].data-id=rest-admin-gateway-server-dev.yaml
spring.cloud.nacos.config.shared-configs[0].group=ARCHETYPE_GROUP
spring.cloud.nacos.config.shared-configs[0].refresh=true
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!