update nacos 2.2.0 => 2.2.1

2.X
疯狂的狮子li 2 years ago
parent e3aa1eb83f
commit f822934164

@ -17,7 +17,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.7.9</spring-boot.version>
<spring-boot.version>2.7.10</spring-boot.version>
<spring-cloud.version>2021.0.6</spring-cloud.version>
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
<spring-boot.mybatis>2.2.2</spring-boot.mybatis>

@ -17,7 +17,7 @@
<spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
<sentinel.version>1.8.6</sentinel.version>
<seata.version>1.6.1</seata.version>
<nacos.client.version>2.2.0</nacos.client.version>
<nacos.client.version>2.2.1</nacos.client.version>
<dubbo.version>3.1.7</dubbo.version>
<spring.context.support.version>1.0.11</spring.context.support.version>
</properties>

@ -27,7 +27,7 @@
<packaging>jar</packaging>
<properties>
<nacos.version>2.2.0</nacos.version>
<nacos.version>2.2.1</nacos.version>
<!-- 需要与 Nacos 内置 Boot 版本保持一致 -->
<spring-boot-admin.version>2.6.11</spring-boot-admin.version>
<nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path>

@ -28,7 +28,13 @@ import com.alibaba.nacos.console.service.NamespaceOperationService;
import com.alibaba.nacos.plugin.auth.constant.ActionTypes;
import com.alibaba.nacos.plugin.auth.impl.constant.AuthConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.UUID;
@ -42,17 +48,17 @@ import java.util.regex.Pattern;
@RestController
@RequestMapping("/v1/console/namespaces")
public class NamespaceController {
@Autowired
private CommonPersistService commonPersistService;
@Autowired
private NamespaceOperationService namespaceOperationService;
private final Pattern namespaceIdCheckPattern = Pattern.compile("^[\\w-]+");
private static final int NAMESPACE_ID_MAX_LENGTH = 128;
/**
* Get namespace list.
*
@ -62,7 +68,7 @@ public class NamespaceController {
public RestResult<List<Namespace>> getNamespaces() {
return RestResultUtils.success(namespaceOperationService.getNamespaceList());
}
/**
* get namespace all info by namespace id.
*
@ -73,7 +79,7 @@ public class NamespaceController {
public NamespaceAllInfo getNamespace(@RequestParam("namespaceId") String namespaceId) throws NacosException {
return namespaceOperationService.getNamespace(namespaceId);
}
/**
* create namespace.
*
@ -103,7 +109,7 @@ public class NamespaceController {
return false;
}
}
/**
* check namespaceId exist.
*
@ -117,7 +123,7 @@ public class NamespaceController {
}
return (commonPersistService.tenantInfoCountByTenantId(namespaceId) > 0);
}
/**
* edit namespace.
*
@ -133,7 +139,7 @@ public class NamespaceController {
@RequestParam(value = "namespaceDesc", required = false) String namespaceDesc) {
return namespaceOperationService.editNamespace(namespace, namespaceShowName, namespaceDesc);
}
/**
* del namespace by id.
*
@ -145,5 +151,5 @@ public class NamespaceController {
public Boolean deleteNamespace(@RequestParam("namespaceId") String namespaceId) {
return namespaceOperationService.removeNamespace(namespaceId);
}
}

@ -31,7 +31,13 @@ import com.alibaba.nacos.plugin.auth.constant.ActionTypes;
import com.alibaba.nacos.plugin.auth.constant.SignType;
import com.alibaba.nacos.plugin.auth.impl.constant.AuthConstants;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.UUID;
@ -45,19 +51,19 @@ import java.util.regex.Pattern;
*/
@NacosApi
@RestController
@RequestMapping(path = "/v2/console/namespace")
@RequestMapping("/v2/console/namespace")
public class NamespaceControllerV2 {
private final NamespaceOperationService namespaceOperationService;
public NamespaceControllerV2(NamespaceOperationService namespaceOperationService) {
this.namespaceOperationService = namespaceOperationService;
}
private final Pattern namespaceIdCheckPattern = Pattern.compile("^[\\w-]+");
private static final int NAMESPACE_ID_MAX_LENGTH = 128;
/**
* Get namespace list.
*
@ -67,7 +73,7 @@ public class NamespaceControllerV2 {
public Result<List<Namespace>> getNamespaceList() {
return Result.success(namespaceOperationService.getNamespaceList());
}
/**
* get namespace all info by namespace id.
*
@ -81,7 +87,7 @@ public class NamespaceControllerV2 {
throws NacosException {
return Result.success(namespaceOperationService.getNamespace(namespaceId));
}
/**
* create namespace.
*
@ -92,13 +98,13 @@ public class NamespaceControllerV2 {
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX
+ "namespaces", action = ActionTypes.WRITE, signType = SignType.CONSOLE)
public Result<Boolean> createNamespace(NamespaceForm namespaceForm) throws NacosException {
namespaceForm.validate();
String namespaceId = namespaceForm.getNamespaceId();
String namespaceName = namespaceForm.getNamespaceName();
String namespaceDesc = namespaceForm.getNamespaceDesc();
if (StringUtils.isBlank(namespaceId)) {
namespaceId = UUID.randomUUID().toString();
} else {
@ -114,7 +120,7 @@ public class NamespaceControllerV2 {
}
return Result.success(namespaceOperationService.createNamespace(namespaceId, namespaceName, namespaceDesc));
}
/**
* edit namespace.
*
@ -130,7 +136,7 @@ public class NamespaceControllerV2 {
.editNamespace(namespaceForm.getNamespaceId(), namespaceForm.getNamespaceName(),
namespaceForm.getNamespaceDesc()));
}
/**
* delete namespace by id.
*

@ -16,10 +16,10 @@
package com.alibaba.nacos.console.exception;
import com.alibaba.nacos.plugin.auth.exception.AccessException;
import com.alibaba.nacos.common.model.RestResultUtils;
import com.alibaba.nacos.common.utils.ExceptionUtil;
import com.alibaba.nacos.core.utils.Commons;
import com.alibaba.nacos.plugin.auth.exception.AccessException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@ -37,20 +37,20 @@ import javax.servlet.http.HttpServletRequest;
*/
@ControllerAdvice
public class ConsoleExceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleExceptionHandler.class);
@ExceptionHandler(AccessException.class)
private ResponseEntity<String> handleAccessException(AccessException e) {
LOGGER.error("got exception. {}", e.getErrMsg());
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(e.getErrMsg());
}
@ExceptionHandler(IllegalArgumentException.class)
private ResponseEntity<String> handleIllegalArgumentException(IllegalArgumentException e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ExceptionUtil.getAllExceptionMsg(e));
}
@ExceptionHandler(Exception.class)
private ResponseEntity<Object> handleException(HttpServletRequest request, Exception e) {
String uri = request.getRequestURI();

@ -19,6 +19,7 @@ package com.alibaba.nacos.console.service;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.exception.api.NacosApiException;
import com.alibaba.nacos.api.model.v2.ErrorCode;
import com.alibaba.nacos.common.utils.NamespaceUtil;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.config.server.model.TenantInfo;
import com.alibaba.nacos.config.server.service.repository.CommonPersistService;
@ -70,7 +71,7 @@ public class NamespaceOperationService {
// TODO 获取用kp
List<TenantInfo> tenantInfos = commonPersistService.findTenantByKp(DEFAULT_KP);
Namespace namespace0 = new Namespace("", DEFAULT_NAMESPACE, DEFAULT_QUOTA,
Namespace namespace0 = new Namespace(NamespaceUtil.getNamespaceDefaultId(), DEFAULT_NAMESPACE, DEFAULT_QUOTA,
configInfoPersistService.configInfoCount(DEFAULT_TENANT), NamespaceTypeEnum.GLOBAL.getType());
List<Namespace> namespaceList = new ArrayList<>();
namespaceList.add(namespace0);
@ -92,7 +93,7 @@ public class NamespaceOperationService {
*/
public NamespaceAllInfo getNamespace(String namespaceId) throws NacosException {
// TODO 获取用kp
if (StringUtils.isBlank(namespaceId)) {
if (StringUtils.isBlank(namespaceId) || namespaceId.equals(NamespaceUtil.getNamespaceDefaultId())) {
return new NamespaceAllInfo(namespaceId, DEFAULT_NAMESPACE_SHOW_NAME, DEFAULT_QUOTA,
configInfoPersistService.configInfoCount(DEFAULT_TENANT), NamespaceTypeEnum.GLOBAL.getType(),
DEFAULT_NAMESPACE_DESCRIPTION);

@ -42,10 +42,6 @@ db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=root
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2
#*************** Naming Module Related Configurations ***************#
### Data dispatch task execution period in milliseconds:
@ -125,13 +121,17 @@ nacos.core.auth.enable.userAgentAuthWhite=false
### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
### 此处为用户名密码 需要自行修改
nacos.core.auth.server.identity.key=serverIdentity
nacos.core.auth.server.identity.value=security
### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds:
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
### The default token:
### The default token (Base64 string):
#nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
### 此处为token密钥 需要自行修改
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
### worked when nacos.core.auth.system.type=ldap{0} is Placeholder,replace login username

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?c18229e4d79449526734" rel="stylesheet"></head>
<link href="./css/main.css?9f68bc0e1a07ae7085fe" 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?c18229e4d79449526734"></script></body>
<script type="text/javascript" src="./js/main.js?9f68bc0e1a07ae7085fe"></script></body>
</html>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save