【fix sonar】GatewayRoutersConfiguration文件
This commit is contained in:
+30
-25
@@ -36,45 +36,55 @@ public class GatewayRoutersConfiguration {
|
||||
|
||||
public static String ROUTE_GROUP;
|
||||
|
||||
public static String USERNAME;
|
||||
|
||||
public static String PASSWORD;
|
||||
|
||||
/**
|
||||
* 路由配置文件数据获取方式yml,nacos,database
|
||||
*/
|
||||
public static String DATA_TYPE;
|
||||
|
||||
@Value("${spring.cloud.nacos.discovery.server-addr}")
|
||||
public static void setServerAddr(String serverAddr) {
|
||||
SERVER_ADDR = serverAddr;
|
||||
public void setServerAddr(String serverAddr) {
|
||||
synchronized (GatewayRoutersConfiguration.class){
|
||||
if(SERVER_ADDR == null){
|
||||
SERVER_ADDR = serverAddr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${spring.cloud.nacos.discovery.namespace}")
|
||||
public static void setNamespace(String namespace) {
|
||||
NAMESPACE = namespace;
|
||||
public void setNamespace(String namespace) {
|
||||
synchronized (GatewayRoutersConfiguration.class){
|
||||
if(NAMESPACE == null){
|
||||
NAMESPACE = namespace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${jero.route.config.data-id:#{null}}")
|
||||
public static void setRouteDataId(String dataId) {
|
||||
DATA_ID = dataId + ".json";
|
||||
public void setRouteDataId(String dataId) {
|
||||
synchronized (GatewayRoutersConfiguration.class){
|
||||
if(DATA_ID == null){
|
||||
DATA_ID = dataId + ".json";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${jero.route.config.group:DEFAULT_GROUP:#{null}}")
|
||||
public static void setRouteGroup(String routeGroup) {
|
||||
ROUTE_GROUP = routeGroup;
|
||||
public void setRouteGroup(String routeGroup) {
|
||||
synchronized (GatewayRoutersConfiguration.class){
|
||||
if(ROUTE_GROUP == null){
|
||||
ROUTE_GROUP = routeGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${jero.route.config.data-type}")
|
||||
public static void setDataType(String dataType) { DATA_TYPE = dataType; }
|
||||
public void setDataType(String dataType) {
|
||||
synchronized (GatewayRoutersConfiguration.class){
|
||||
if(DATA_TYPE == null){
|
||||
DATA_TYPE = dataType;
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${spring.cloud.nacos.config.username}")
|
||||
public static void setUsername(String username) {
|
||||
USERNAME = username;
|
||||
}
|
||||
@Value("${spring.cloud.nacos.config.password}")
|
||||
public static void setPassword(String password) {
|
||||
PASSWORD = password;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,11 +99,6 @@ public class GatewayRoutersConfiguration {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 映射接口文档默认地址(通过9999端口直接访问)
|
||||
* @param indexHtml
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
|
||||
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
|
||||
|
||||
@@ -42,3 +42,6 @@ jero:
|
||||
fileSuffixLimits: 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
||||
# 跨站白名单
|
||||
whiteUrls:
|
||||
route:
|
||||
config:
|
||||
data-type: yml
|
||||
|
||||
Reference in New Issue
Block a user