mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-22 12:48:58 +08:00
upgrade(nacos server): up nacos 2.4.1
This commit is contained in:
parent
62ba7cf04a
commit
de56d3dfcb
@ -21,44 +21,45 @@
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<artifactId>pig-register</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>pig-register</name>
|
||||
<description>nacos 注册配置中心</description>
|
||||
|
||||
<properties>
|
||||
<nacos.version>2.3.2-OEM</nacos.version>
|
||||
<nacos.version>2.4.1.0</nacos.version>
|
||||
<spring-boot.version>2.7.18</spring-boot.version>
|
||||
<spring-boot-admin.version>2.7.16</spring-boot-admin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>group.springframework.nacos</groupId>
|
||||
<groupId>io.github.pig-mesh.nacos</groupId>
|
||||
<artifactId>nacos-config</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>group.springframework.nacos</groupId>
|
||||
<groupId>io.github.pig-mesh.nacos</groupId>
|
||||
<artifactId>nacos-naming</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>group.springframework.nacos</groupId>
|
||||
<groupId>io.github.pig-mesh.nacos</groupId>
|
||||
<artifactId>nacos-istio</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>group.springframework.nacos</groupId>
|
||||
<groupId>io.github.pig-mesh.nacos</groupId>
|
||||
<artifactId>nacos-default-plugin-all</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>group.springframework.nacos</groupId>
|
||||
<groupId>io.github.pig-mesh.nacos</groupId>
|
||||
<artifactId>nacos-prometheus</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
@ -81,6 +82,7 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<!--依赖版本声明-->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package com.alibaba.nacos;
|
||||
|
||||
import com.alibaba.nacos.config.ConfigConstants;
|
||||
import com.alibaba.nacos.console.config.ConfigConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.alibaba.nacos.config;
|
||||
package com.alibaba.nacos.console.config;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
@ -14,8 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.alibaba.nacos.config;
|
||||
package com.alibaba.nacos.console.config;
|
||||
|
||||
import com.alibaba.nacos.console.filter.XssFilter;
|
||||
import com.alibaba.nacos.core.code.ControllerMethodsCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -49,10 +50,6 @@ public class ConsoleConfig {
|
||||
@Value("${nacos.console.ui.enabled:true}")
|
||||
private boolean consoleUiEnabled;
|
||||
|
||||
public boolean isConsoleUiEnabled() {
|
||||
return consoleUiEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init.
|
||||
*/
|
||||
@ -61,25 +58,34 @@ public class ConsoleConfig {
|
||||
methodsCache.initClassMethod("com.alibaba.nacos.core.controller");
|
||||
methodsCache.initClassMethod("com.alibaba.nacos.naming.controllers");
|
||||
methodsCache.initClassMethod("com.alibaba.nacos.config.server.controller");
|
||||
methodsCache.initClassMethod("com.alibaba.nacos.controller");
|
||||
methodsCache.initClassMethod("com.alibaba.nacos.console.controller");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.setAllowCredentials(true);
|
||||
config.addAllowedOriginPattern("*");
|
||||
config.addAllowedHeader("*");
|
||||
config.setMaxAge(18000L);
|
||||
config.addAllowedMethod("*");
|
||||
config.addAllowedOriginPattern("*");
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public XssFilter xssFilter() {
|
||||
return new XssFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
|
||||
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(ZoneId.systemDefault().toString());
|
||||
}
|
||||
|
||||
public boolean isConsoleUiEnabled() {
|
||||
return consoleUiEnabled;
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,6 @@
|
||||
|
||||
package com.alibaba.nacos.console.config;
|
||||
|
||||
import com.alibaba.nacos.config.ConsoleConfig;
|
||||
import com.alibaba.nacos.sys.module.ModuleState;
|
||||
import com.alibaba.nacos.sys.module.ModuleStateBuilder;
|
||||
import com.alibaba.nacos.sys.utils.ApplicationUtils;
|
||||
|
@ -20,17 +20,22 @@ import com.alibaba.nacos.common.model.RestResult;
|
||||
import com.alibaba.nacos.common.model.RestResultUtils;
|
||||
import com.alibaba.nacos.console.paramcheck.ConsoleDefaultHttpParamExtractor;
|
||||
import com.alibaba.nacos.core.paramcheck.ExtractorManager;
|
||||
import com.alibaba.nacos.sys.env.EnvUtil;
|
||||
import com.alibaba.nacos.sys.module.ModuleState;
|
||||
import com.alibaba.nacos.sys.module.ModuleStateHolder;
|
||||
import com.alibaba.nacos.sys.utils.DiskUtils;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.alibaba.nacos.common.utils.StringUtils.*;
|
||||
|
||||
/**
|
||||
* Server state controller.
|
||||
*
|
||||
@ -41,6 +46,10 @@ import java.util.Map;
|
||||
@ExtractorManager.Extractor(httpExtractor = ConsoleDefaultHttpParamExtractor.class)
|
||||
public class ServerStateController {
|
||||
|
||||
private static final String ANNOUNCEMENT_FILE = "announcement.conf";
|
||||
|
||||
private static final String GUIDE_FILE = "console-guide.conf";
|
||||
|
||||
/**
|
||||
* Get server state of current server.
|
||||
* @return state json.
|
||||
@ -57,12 +66,26 @@ public class ServerStateController {
|
||||
@GetMapping("/announcement")
|
||||
public RestResult<String> getAnnouncement(
|
||||
@RequestParam(required = false, name = "language", defaultValue = "zh-CN") String language) {
|
||||
return RestResultUtils.success();
|
||||
String file = ANNOUNCEMENT_FILE.substring(0, ANNOUNCEMENT_FILE.length() - 5) + "_" + language + ".conf";
|
||||
if (file.contains(TOP_PATH) || file.contains(FOLDER_SEPARATOR) || file.contains(WINDOWS_FOLDER_SEPARATOR)) {
|
||||
throw new IllegalArgumentException("Invalid filename");
|
||||
}
|
||||
File announcementFile = new File(EnvUtil.getConfPath(), file);
|
||||
String announcement = null;
|
||||
if (announcementFile.exists() && announcementFile.isFile()) {
|
||||
announcement = DiskUtils.readFile(announcementFile);
|
||||
}
|
||||
return RestResultUtils.success(announcement);
|
||||
}
|
||||
|
||||
@GetMapping("/guide")
|
||||
public RestResult<String> getConsoleUiGuide() {
|
||||
return RestResultUtils.success();
|
||||
File guideFile = new File(EnvUtil.getConfPath(), GUIDE_FILE);
|
||||
String guideInformation = null;
|
||||
if (guideFile.exists() && guideFile.isFile()) {
|
||||
guideInformation = DiskUtils.readFile(guideFile);
|
||||
}
|
||||
return RestResultUtils.success(guideInformation);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
version=2.3.2-OEM
|
||||
version=2.4.1
|
||||
|
File diff suppressed because one or more lines are too long
@ -35,7 +35,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css">
|
||||
<link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css">
|
||||
<!-- 第三方css结束 -->
|
||||
<link href="./css/main.css?c02a3284f12026e72980" rel="stylesheet"></head>
|
||||
<link href="./css/main.css?0c44b904d360f744c82e" rel="stylesheet"></head>
|
||||
|
||||
<body>
|
||||
<div id="root" style="overflow:hidden"></div>
|
||||
@ -56,6 +56,6 @@
|
||||
<script src="console-ui/public/js/merge.js"></script>
|
||||
<script src="console-ui/public/js/loader.js"></script>
|
||||
<!-- 第三方js结束 -->
|
||||
<script type="text/javascript" src="./js/main.js?c02a3284f12026e72980"></script></body>
|
||||
<script type="text/javascript" src="./js/main.js?0c44b904d360f744c82e"></script></body>
|
||||
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user