【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 ROUTE_GROUP;
|
||||||
|
|
||||||
public static String USERNAME;
|
|
||||||
|
|
||||||
public static String PASSWORD;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由配置文件数据获取方式yml,nacos,database
|
* 路由配置文件数据获取方式yml,nacos,database
|
||||||
*/
|
*/
|
||||||
public static String DATA_TYPE;
|
public static String DATA_TYPE;
|
||||||
|
|
||||||
@Value("${spring.cloud.nacos.discovery.server-addr}")
|
@Value("${spring.cloud.nacos.discovery.server-addr}")
|
||||||
public static void setServerAddr(String serverAddr) {
|
public void setServerAddr(String serverAddr) {
|
||||||
SERVER_ADDR = serverAddr;
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(SERVER_ADDR == null){
|
||||||
|
SERVER_ADDR = serverAddr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${spring.cloud.nacos.discovery.namespace}")
|
@Value("${spring.cloud.nacos.discovery.namespace}")
|
||||||
public static void setNamespace(String namespace) {
|
public void setNamespace(String namespace) {
|
||||||
NAMESPACE = namespace;
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(NAMESPACE == null){
|
||||||
|
NAMESPACE = namespace;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${jero.route.config.data-id:#{null}}")
|
@Value("${jero.route.config.data-id:#{null}}")
|
||||||
public static void setRouteDataId(String dataId) {
|
public void setRouteDataId(String dataId) {
|
||||||
DATA_ID = dataId + ".json";
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(DATA_ID == null){
|
||||||
|
DATA_ID = dataId + ".json";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${jero.route.config.group:DEFAULT_GROUP:#{null}}")
|
@Value("${jero.route.config.group:DEFAULT_GROUP:#{null}}")
|
||||||
public static void setRouteGroup(String routeGroup) {
|
public void setRouteGroup(String routeGroup) {
|
||||||
ROUTE_GROUP = routeGroup;
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(ROUTE_GROUP == null){
|
||||||
|
ROUTE_GROUP = routeGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${jero.route.config.data-type}")
|
@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
|
@Bean
|
||||||
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
|
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));
|
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
|
fileSuffixLimits: 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
||||||
# 跨站白名单
|
# 跨站白名单
|
||||||
whiteUrls:
|
whiteUrls:
|
||||||
|
route:
|
||||||
|
config:
|
||||||
|
data-type: yml
|
||||||
|
|||||||
Reference in New Issue
Block a user