mirror of
https://gitee.com/log4j/pig.git
synced 2025-01-03 23:42:22 +08:00
⬆️ Upgrading dependencies. up nacos 2.2.4 close #I7THAS
This commit is contained in:
parent
42c7d6d7f6
commit
dc24f0fc4b
@ -27,9 +27,9 @@
|
||||
<description>nacos 注册配置中心</description>
|
||||
|
||||
<properties>
|
||||
<nacos.version>2.2.0.PIGOEM</nacos.version>
|
||||
<spring-boot-dependencies.version>2.7.10</spring-boot-dependencies.version>
|
||||
<spring-cloud.version>2021.0.7</spring-cloud.version>
|
||||
<nacos.version>2.2.4</nacos.version>
|
||||
<spring-boot-dependencies.version>2.7.12</spring-boot-dependencies.version>
|
||||
<spring-cloud.version>2021.0.8</spring-cloud.version>
|
||||
<spring-boot-admin.version>2.7.8</spring-boot-admin.version>
|
||||
</properties>
|
||||
|
||||
|
@ -46,6 +46,7 @@ public class PigNacosApplication {
|
||||
System.setProperty(ConfigConstants.AUTH_ENABLED, "false");
|
||||
System.setProperty(ConfigConstants.LOG_BASEDIR, "logs");
|
||||
System.setProperty(ConfigConstants.LOG_ENABLED, "false");
|
||||
System.setProperty(ConfigConstants.NACOS_CONTEXT_PATH, "/nacos");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -45,4 +45,9 @@ public interface ConfigConstants {
|
||||
*/
|
||||
String LOG_ENABLED = "server.tomcat.accesslog.enabled";
|
||||
|
||||
/**
|
||||
* 路径 nacos context path
|
||||
*/
|
||||
String NACOS_CONTEXT_PATH = "server.servlet.contextPath";
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import java.time.ZoneId;
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@PropertySource("/application.properties")
|
||||
@PropertySource("/application.yml")
|
||||
public class ConsoleConfig {
|
||||
|
||||
@Autowired
|
||||
|
@ -51,10 +51,10 @@ public class HealthController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Nacos is in broken states or not, and cannot recover except by being
|
||||
* restarted.
|
||||
* @return HTTP code equal to 200 indicates that Nacos is in right states. HTTP code
|
||||
* equal to 500 indicates that Nacos is in broken states.
|
||||
* Whether the Nacos is in broken states or not, and cannot recover except by being restarted.
|
||||
*
|
||||
* @return HTTP code equal to 200 indicates that Nacos is in right states. HTTP code equal to 500 indicates that
|
||||
* Nacos is in broken states.
|
||||
*/
|
||||
@GetMapping("/liveness")
|
||||
public ResponseEntity<String> liveness() {
|
||||
@ -63,8 +63,9 @@ public class HealthController {
|
||||
|
||||
/**
|
||||
* Ready to receive the request or not.
|
||||
* @return HTTP code equal to 200 indicates that Nacos is ready. HTTP code equal to
|
||||
* 500 indicates that Nacos is not ready.
|
||||
*
|
||||
* @return HTTP code equal to 200 indicates that Nacos is ready. HTTP code equal to 500 indicates that Nacos is not
|
||||
* ready.
|
||||
*/
|
||||
@GetMapping("/readiness")
|
||||
public ResponseEntity<String> readiness(HttpServletRequest request) {
|
||||
@ -76,8 +77,7 @@ public class HealthController {
|
||||
}
|
||||
|
||||
if (!isConfigReadiness && !isNamingReadiness) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body("Config and Naming are not in readiness");
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Config and Naming are not in readiness");
|
||||
}
|
||||
|
||||
if (!isConfigReadiness) {
|
||||
@ -92,8 +92,7 @@ public class HealthController {
|
||||
try {
|
||||
configInfoPersistService.configInfoCount("");
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Config health check fail.", e);
|
||||
}
|
||||
return false;
|
||||
@ -103,11 +102,9 @@ public class HealthController {
|
||||
try {
|
||||
apiCommands.metrics(request);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Naming health check fail.", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
@ -55,6 +61,7 @@ public class NamespaceController {
|
||||
|
||||
/**
|
||||
* Get namespace list.
|
||||
*
|
||||
* @return namespace list
|
||||
*/
|
||||
@GetMapping
|
||||
@ -64,6 +71,7 @@ public class NamespaceController {
|
||||
|
||||
/**
|
||||
* get namespace all info by namespace id.
|
||||
*
|
||||
* @param namespaceId namespaceId
|
||||
* @return namespace all info
|
||||
*/
|
||||
@ -74,6 +82,7 @@ public class NamespaceController {
|
||||
|
||||
/**
|
||||
* create namespace.
|
||||
*
|
||||
* @param namespaceName namespace Name
|
||||
* @param namespaceDesc namespace Desc
|
||||
* @return whether create ok
|
||||
@ -85,8 +94,7 @@ public class NamespaceController {
|
||||
@RequestParam(value = "namespaceDesc", required = false) String namespaceDesc) {
|
||||
if (StringUtils.isBlank(namespaceId)) {
|
||||
namespaceId = UUID.randomUUID().toString();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
namespaceId = namespaceId.trim();
|
||||
if (!namespaceIdCheckPattern.matcher(namespaceId).matches()) {
|
||||
return false;
|
||||
@ -97,14 +105,14 @@ public class NamespaceController {
|
||||
}
|
||||
try {
|
||||
return namespaceOperationService.createNamespace(namespaceId, namespaceName, namespaceDesc);
|
||||
}
|
||||
catch (NacosException e) {
|
||||
} catch (NacosException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check namespaceId exist.
|
||||
*
|
||||
* @param namespaceId namespace id
|
||||
* @return true if exist, otherwise false
|
||||
*/
|
||||
@ -118,6 +126,7 @@ public class NamespaceController {
|
||||
|
||||
/**
|
||||
* edit namespace.
|
||||
*
|
||||
* @param namespace namespace
|
||||
* @param namespaceShowName namespace ShowName
|
||||
* @param namespaceDesc namespace Desc
|
||||
@ -133,6 +142,7 @@ public class NamespaceController {
|
||||
|
||||
/**
|
||||
* del namespace by id.
|
||||
*
|
||||
* @param namespaceId namespace Id
|
||||
* @return whether del ok
|
||||
*/
|
||||
|
@ -16,13 +16,19 @@
|
||||
|
||||
package com.alibaba.nacos.console.controller;
|
||||
|
||||
import com.alibaba.nacos.common.utils.VersionUtils;
|
||||
import com.alibaba.nacos.sys.env.EnvUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.alibaba.nacos.common.model.RestResult;
|
||||
import com.alibaba.nacos.common.model.RestResultUtils;
|
||||
import com.alibaba.nacos.sys.module.ModuleState;
|
||||
import com.alibaba.nacos.sys.module.ModuleStateHolder;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
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.RestController;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -35,20 +41,26 @@ import java.util.Map;
|
||||
@RequestMapping("/v1/console/server")
|
||||
public class ServerStateController {
|
||||
|
||||
private static final String ANNOUNCEMENT_FILE = "conf/announcement.conf";
|
||||
|
||||
/**
|
||||
* Get server state of current server.
|
||||
*
|
||||
* @return state json.
|
||||
*/
|
||||
@GetMapping("/state")
|
||||
public ResponseEntity<Map<String, String>> serverState() {
|
||||
Map<String, String> serverState = new HashMap<>(4);
|
||||
serverState.put("standalone_mode",
|
||||
EnvUtil.getStandaloneMode() ? EnvUtil.STANDALONE_MODE_ALONE : EnvUtil.STANDALONE_MODE_CLUSTER);
|
||||
|
||||
serverState.put("function_mode", EnvUtil.getFunctionMode());
|
||||
serverState.put("version", VersionUtils.version);
|
||||
|
||||
for (ModuleState each : ModuleStateHolder.getInstance().getAllModuleStates()) {
|
||||
each.getStates().forEach((s, o) -> serverState.put(s, null == o ? null : o.toString()));
|
||||
}
|
||||
return ResponseEntity.ok().body(serverState);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@GetMapping("/announcement")
|
||||
public RestResult<String> getAnnouncement() {
|
||||
ClassPathResource resource = new ClassPathResource(ANNOUNCEMENT_FILE);
|
||||
return RestResultUtils.success(FileUtil.readString(resource.getFile(), Charset.defaultCharset()));
|
||||
}
|
||||
}
|
||||
|
@ -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,7 +51,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
@NacosApi
|
||||
@RestController
|
||||
@RequestMapping(path = "/v2/console/namespace")
|
||||
@RequestMapping("/v2/console/namespace")
|
||||
public class NamespaceControllerV2 {
|
||||
|
||||
private final NamespaceOperationService namespaceOperationService;
|
||||
@ -60,6 +66,7 @@ public class NamespaceControllerV2 {
|
||||
|
||||
/**
|
||||
* Get namespace list.
|
||||
*
|
||||
* @return namespace list
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ -69,12 +76,13 @@ public class NamespaceControllerV2 {
|
||||
|
||||
/**
|
||||
* get namespace all info by namespace id.
|
||||
*
|
||||
* @param namespaceId namespaceId
|
||||
* @return namespace all info
|
||||
*/
|
||||
@GetMapping()
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "namespaces", action = ActionTypes.READ,
|
||||
signType = SignType.CONSOLE)
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX
|
||||
+ "namespaces", action = ActionTypes.READ, signType = SignType.CONSOLE)
|
||||
public Result<NamespaceAllInfo> getNamespace(@RequestParam("namespaceId") String namespaceId)
|
||||
throws NacosException {
|
||||
return Result.success(namespaceOperationService.getNamespace(namespaceId));
|
||||
@ -82,12 +90,13 @@ public class NamespaceControllerV2 {
|
||||
|
||||
/**
|
||||
* create namespace.
|
||||
*
|
||||
* @param namespaceForm namespaceForm.
|
||||
* @return whether create ok
|
||||
*/
|
||||
@PostMapping
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "namespaces", action = ActionTypes.WRITE,
|
||||
signType = SignType.CONSOLE)
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX
|
||||
+ "namespaces", action = ActionTypes.WRITE, signType = SignType.CONSOLE)
|
||||
public Result<Boolean> createNamespace(NamespaceForm namespaceForm) throws NacosException {
|
||||
|
||||
namespaceForm.validate();
|
||||
@ -98,8 +107,7 @@ public class NamespaceControllerV2 {
|
||||
|
||||
if (StringUtils.isBlank(namespaceId)) {
|
||||
namespaceId = UUID.randomUUID().toString();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
namespaceId = namespaceId.trim();
|
||||
if (!namespaceIdCheckPattern.matcher(namespaceId).matches()) {
|
||||
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.ILLEGAL_NAMESPACE,
|
||||
@ -115,28 +123,30 @@ public class NamespaceControllerV2 {
|
||||
|
||||
/**
|
||||
* edit namespace.
|
||||
*
|
||||
* @param namespaceForm namespace params
|
||||
* @return whether edit ok
|
||||
*/
|
||||
@PutMapping
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "namespaces", action = ActionTypes.WRITE,
|
||||
signType = SignType.CONSOLE)
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX
|
||||
+ "namespaces", action = ActionTypes.WRITE, signType = SignType.CONSOLE)
|
||||
public Result<Boolean> editNamespace(NamespaceForm namespaceForm) throws NacosException {
|
||||
namespaceForm.validate();
|
||||
return Result.success(namespaceOperationService.editNamespace(namespaceForm.getNamespaceId(),
|
||||
namespaceForm.getNamespaceName(), namespaceForm.getNamespaceDesc()));
|
||||
return Result.success(namespaceOperationService
|
||||
.editNamespace(namespaceForm.getNamespaceId(), namespaceForm.getNamespaceName(),
|
||||
namespaceForm.getNamespaceDesc()));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete namespace by id.
|
||||
*
|
||||
* @param namespaceId namespace ID
|
||||
* @return whether delete ok
|
||||
*/
|
||||
@DeleteMapping
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "namespaces", action = ActionTypes.WRITE,
|
||||
signType = SignType.CONSOLE)
|
||||
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX
|
||||
+ "namespaces", action = ActionTypes.WRITE, signType = SignType.CONSOLE)
|
||||
public Result<Boolean> deleteNamespace(@RequestParam("namespaceId") String namespaceId) {
|
||||
return Result.success(namespaceOperationService.removeNamespace(namespaceId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
package com.alibaba.nacos.console.enums;
|
||||
|
||||
/**
|
||||
* the enum of namespace. 0 : Global configuration, 1 : Default private namespace ,2 :
|
||||
* Custom namespace.
|
||||
* the enum of namespace.
|
||||
* 0 : Global configuration, 1 : Default private namespace ,2 : Custom namespace.
|
||||
*
|
||||
* @author chenglu
|
||||
* @date 2021-05-25 17:01
|
||||
@ -62,5 +62,5 @@ public enum NamespaceTypeEnum {
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -61,5 +61,4 @@ public class ConsoleExceptionHandler {
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ExceptionUtil.getAllExceptionMsg(e));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,13 +43,12 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Exception Handler for Nacos API.
|
||||
*
|
||||
* @author dongyafei
|
||||
* @date 2022/7/22
|
||||
*/
|
||||
|
||||
@Order(-1)
|
||||
@ControllerAdvice(annotations = { NacosApi.class })
|
||||
@ControllerAdvice(annotations = {NacosApi.class})
|
||||
@ResponseBody
|
||||
public class NacosApiExceptionHandler {
|
||||
|
||||
@ -58,8 +57,7 @@ public class NacosApiExceptionHandler {
|
||||
@ExceptionHandler(NacosApiException.class)
|
||||
public ResponseEntity<Result<String>> handleNacosApiException(NacosApiException e) {
|
||||
LOGGER.error("got exception. {} {}", e.getErrAbstract(), e.getErrMsg());
|
||||
return ResponseEntity.status(e.getErrCode())
|
||||
.body(new Result<>(e.getDetailErrCode(), e.getErrAbstract(), e.getErrMsg()));
|
||||
return ResponseEntity.status(e.getErrCode()).body(new Result<>(e.getDetailErrCode(), e.getErrAbstract(), e.getErrMsg()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(NacosException.class)
|
||||
@ -118,7 +116,7 @@ public class NacosApiExceptionHandler {
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(value = { DataAccessException.class, ServletException.class, IOException.class })
|
||||
@ExceptionHandler(value = {DataAccessException.class, ServletException.class, IOException.class})
|
||||
public Result<String> handleDataAccessException(Exception e) {
|
||||
LOGGER.error("got exception. {} {}", e.getMessage(), ExceptionUtil.getAllExceptionMsg(e));
|
||||
return Result.failure(ErrorCode.DATA_ACCESS_ERROR, e.getMessage());
|
||||
@ -130,5 +128,4 @@ public class NacosApiExceptionHandler {
|
||||
LOGGER.error("got exception. {} {}", e.getMessage(), ExceptionUtil.getAllExceptionMsg(e));
|
||||
return Result.failure(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* XSS filter.
|
||||
*
|
||||
* @author onewe
|
||||
*/
|
||||
public class XssFilter extends OncePerRequestFilter {
|
||||
@ -42,5 +41,4 @@ public class XssFilter extends OncePerRequestFilter {
|
||||
response.setHeader(CONTENT_SECURITY_POLICY_HEADER, CONTENT_SECURITY_POLICY);
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* NamespaceForm.
|
||||
*
|
||||
* @author dongyafei
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@ -103,13 +102,10 @@ public class NamespaceForm implements Serializable {
|
||||
*/
|
||||
public void validate() throws NacosException {
|
||||
if (null == namespaceId) {
|
||||
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,
|
||||
"required parameter 'namespaceId' is missing");
|
||||
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING, "required parameter 'namespaceId' is missing");
|
||||
}
|
||||
if (null == namespaceName) {
|
||||
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,
|
||||
"required parameter 'namespaceName' is missing");
|
||||
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING, "required parameter 'namespaceName' is missing");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
@ -86,17 +87,17 @@ public class NamespaceOperationService {
|
||||
|
||||
/**
|
||||
* query namespace by namespace id.
|
||||
*
|
||||
* @param namespaceId namespace Id.
|
||||
* @return NamespaceAllInfo.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
TenantInfo tenantInfo = commonPersistService.findTenantByKp(DEFAULT_KP, namespaceId);
|
||||
if (null == tenantInfo) {
|
||||
throw new NacosApiException(HttpStatus.NOT_FOUND.value(), ErrorCode.NAMESPACE_NOT_EXIST,
|
||||
@ -110,6 +111,7 @@ public class NamespaceOperationService {
|
||||
|
||||
/**
|
||||
* create namespace.
|
||||
*
|
||||
* @param namespaceId namespace ID
|
||||
* @param namespaceName namespace Name
|
||||
* @param namespaceDesc namespace Desc
|
||||
@ -123,8 +125,9 @@ public class NamespaceOperationService {
|
||||
"namespaceId [" + namespaceId + "] already exist");
|
||||
}
|
||||
|
||||
commonPersistService.insertTenantInfoAtomic(DEFAULT_KP, namespaceId, namespaceName, namespaceDesc,
|
||||
DEFAULT_CREATE_SOURCE, System.currentTimeMillis());
|
||||
commonPersistService
|
||||
.insertTenantInfoAtomic(DEFAULT_KP, namespaceId, namespaceName, namespaceDesc, DEFAULT_CREATE_SOURCE,
|
||||
System.currentTimeMillis());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -144,5 +147,4 @@ public class NamespaceOperationService {
|
||||
commonPersistService.removeTenantInfoAtomic(DEFAULT_KP, namespaceId);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
#
|
||||
# Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Console Default Properties
|
||||
|
||||
spring.mvc.view.prefix=/jsp/
|
||||
# the default suffix of page
|
||||
spring.mvc.view.suffix=.jsp
|
||||
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
|
||||
#logging.level.root=DEBUG
|
||||
|
||||
# P0 key,For Debug. whether use address-server; true:use; false:not use;default:true
|
||||
useAddressServer=true
|
||||
|
||||
# whether open interInterFaceFilter; true:open; false:close; if open, others can't call inner interface. default:false
|
||||
openInnerInterfaceFilter=false
|
||||
|
||||
# quickStart stip dumpAll;only dump change config
|
||||
isQuickStart=false
|
||||
|
||||
# server notify each otherd
|
||||
notifyConnectTimeout=200
|
||||
|
||||
# server notify each other
|
||||
notifySocketTimeout=8000
|
||||
|
||||
# whether health check
|
||||
isHealthCheck=true
|
||||
|
||||
# health check max fail count
|
||||
maxHealthCheckFailCount=12
|
||||
|
||||
# whether open spas; true:open; false:close
|
||||
OPEN_SPAS=true
|
||||
|
||||
nacos.cmdb.dumpTaskInterval=3600
|
||||
nacos.cmdb.eventTaskInterval=10
|
||||
nacos.cmdb.labelTaskInterval=300
|
||||
nacos.cmdb.loadDataAtStart=false
|
||||
|
||||
#management.endpoints.web.exposure.include=*
|
||||
|
||||
#spring.security.enabled=false
|
||||
#management.security=false
|
||||
#security.basic.enabled=false
|
||||
#nacos.security.ignore.urls=/**
|
||||
nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/login,/v1/console/health,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/**
|
||||
|
||||
management.metrics.export.elastic.enabled=false
|
||||
#management.metrics.export.elastic.host=http://localhost:9200
|
||||
|
||||
# metrics for influx
|
||||
management.metrics.export.influx.enabled=false
|
||||
#management.metrics.export.influx.db=springboot
|
||||
#management.metrics.export.influx.uri=http://localhost:8086
|
||||
#management.metrics.export.influx.auto-create-db=true
|
||||
#management.metrics.export.influx.consistency=one
|
||||
#management.metrics.export.influx.compressed=true
|
||||
|
||||
server.tomcat.accesslog.enabled=true
|
||||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D
|
||||
# default current work dir
|
||||
server.tomcat.basedir=
|
||||
|
||||
|
@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
CREATE SCHEMA nacos AUTHORIZATION nacos;
|
||||
|
||||
CREATE TABLE config_info (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) default '',
|
||||
app_name varchar(128),
|
||||
content CLOB,
|
||||
md5 varchar(32) DEFAULT NULL,
|
||||
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
src_user varchar(128) DEFAULT NULL,
|
||||
src_ip varchar(20) DEFAULT NULL,
|
||||
c_desc varchar(256) DEFAULT NULL,
|
||||
c_use varchar(64) DEFAULT NULL,
|
||||
effect varchar(64) DEFAULT NULL,
|
||||
type varchar(64) DEFAULT NULL,
|
||||
c_schema LONG VARCHAR DEFAULT NULL,
|
||||
encrypted_data_key LONG VARCHAR DEFAULT NULL,
|
||||
constraint configinfo_id_key PRIMARY KEY (id),
|
||||
constraint uk_configinfo_datagrouptenant UNIQUE (data_id,group_id,tenant_id));
|
||||
|
||||
CREATE INDEX configinfo_dataid_key_idx ON config_info(data_id);
|
||||
CREATE INDEX configinfo_groupid_key_idx ON config_info(group_id);
|
||||
CREATE INDEX configinfo_dataid_group_key_idx ON config_info(data_id, group_id);
|
||||
|
||||
CREATE TABLE his_config_info (
|
||||
id bigint NOT NULL,
|
||||
nid bigint NOT NULL generated by default as identity,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) default '',
|
||||
app_name varchar(128),
|
||||
content CLOB,
|
||||
md5 varchar(32) DEFAULT NULL,
|
||||
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
|
||||
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
|
||||
src_user varchar(128),
|
||||
src_ip varchar(20) DEFAULT NULL,
|
||||
op_type char(10) DEFAULT NULL,
|
||||
encrypted_data_key LONG VARCHAR DEFAULT NULL,
|
||||
constraint hisconfiginfo_nid_key PRIMARY KEY (nid));
|
||||
|
||||
CREATE INDEX hisconfiginfo_dataid_key_idx ON his_config_info(data_id);
|
||||
CREATE INDEX hisconfiginfo_gmt_create_idx ON his_config_info(gmt_create);
|
||||
CREATE INDEX hisconfiginfo_gmt_modified_idx ON his_config_info(gmt_modified);
|
||||
|
||||
|
||||
CREATE TABLE config_info_beta (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) default '',
|
||||
app_name varchar(128),
|
||||
content CLOB,
|
||||
beta_ips varchar(1024),
|
||||
md5 varchar(32) DEFAULT NULL,
|
||||
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
src_user varchar(128),
|
||||
src_ip varchar(20) DEFAULT NULL,
|
||||
encrypted_data_key LONG VARCHAR DEFAULT NULL,
|
||||
constraint configinfobeta_id_key PRIMARY KEY (id),
|
||||
constraint uk_configinfobeta_datagrouptenant UNIQUE (data_id,group_id,tenant_id));
|
||||
|
||||
CREATE TABLE config_info_tag (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) default '',
|
||||
tag_id varchar(128) NOT NULL,
|
||||
app_name varchar(128),
|
||||
content CLOB,
|
||||
md5 varchar(32) DEFAULT NULL,
|
||||
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
src_user varchar(128),
|
||||
src_ip varchar(20) DEFAULT NULL,
|
||||
constraint configinfotag_id_key PRIMARY KEY (id),
|
||||
constraint uk_configinfotag_datagrouptenanttag UNIQUE (data_id,group_id,tenant_id,tag_id));
|
||||
|
||||
CREATE TABLE config_info_aggr (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) default '',
|
||||
datum_id varchar(255) NOT NULL,
|
||||
app_name varchar(128),
|
||||
content CLOB,
|
||||
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
constraint configinfoaggr_id_key PRIMARY KEY (id),
|
||||
constraint uk_configinfoaggr_datagrouptenantdatum UNIQUE (data_id,group_id,tenant_id,datum_id));
|
||||
|
||||
CREATE TABLE app_list (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
app_name varchar(128) NOT NULL,
|
||||
is_dynamic_collect_disabled smallint DEFAULT 0,
|
||||
last_sub_info_collected_time timestamp DEFAULT '1970-01-01 08:00:00.0',
|
||||
sub_info_lock_owner varchar(128),
|
||||
sub_info_lock_time timestamp DEFAULT '1970-01-01 08:00:00.0',
|
||||
constraint applist_id_key PRIMARY KEY (id),
|
||||
constraint uk_appname UNIQUE (app_name));
|
||||
|
||||
CREATE TABLE app_configdata_relation_subs (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
app_name varchar(128) NOT NULL,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||
constraint configdatarelationsubs_id_key PRIMARY KEY (id),
|
||||
constraint uk_app_sub_config_datagroup UNIQUE (app_name, data_id, group_id));
|
||||
|
||||
|
||||
CREATE TABLE app_configdata_relation_pubs (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
app_name varchar(128) NOT NULL,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||
constraint configdatarelationpubs_id_key PRIMARY KEY (id),
|
||||
constraint uk_app_pub_config_datagroup UNIQUE (app_name, data_id, group_id));
|
||||
|
||||
CREATE TABLE config_tags_relation (
|
||||
id bigint NOT NULL,
|
||||
tag_name varchar(128) NOT NULL,
|
||||
tag_type varchar(64) DEFAULT NULL,
|
||||
data_id varchar(255) NOT NULL,
|
||||
group_id varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) DEFAULT '',
|
||||
nid bigint NOT NULL generated by default as identity,
|
||||
constraint config_tags_id_key PRIMARY KEY (nid),
|
||||
constraint uk_configtagrelation_configidtag UNIQUE (id, tag_name, tag_type));
|
||||
|
||||
CREATE INDEX config_tags_tenant_id_idx ON config_tags_relation(tenant_id);
|
||||
|
||||
CREATE TABLE group_capacity (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
group_id varchar(128) DEFAULT '',
|
||||
quota int DEFAULT 0,
|
||||
usage int DEFAULT 0,
|
||||
max_size int DEFAULT 0,
|
||||
max_aggr_count int DEFAULT 0,
|
||||
max_aggr_size int DEFAULT 0,
|
||||
max_history_count int DEFAULT 0,
|
||||
gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
|
||||
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||
constraint group_capacity_id_key PRIMARY KEY (id),
|
||||
constraint uk_group_id UNIQUE (group_id));
|
||||
|
||||
CREATE TABLE tenant_capacity (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
tenant_id varchar(128) DEFAULT '',
|
||||
quota int DEFAULT 0,
|
||||
usage int DEFAULT 0,
|
||||
max_size int DEFAULT 0,
|
||||
max_aggr_count int DEFAULT 0,
|
||||
max_aggr_size int DEFAULT 0,
|
||||
max_history_count int DEFAULT 0,
|
||||
gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
|
||||
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||
constraint tenant_capacity_id_key PRIMARY KEY (id),
|
||||
constraint uk_tenant_id UNIQUE (tenant_id));
|
||||
|
||||
CREATE TABLE tenant_info (
|
||||
id bigint NOT NULL generated by default as identity,
|
||||
kp varchar(128) NOT NULL,
|
||||
tenant_id varchar(128) DEFAULT '',
|
||||
tenant_name varchar(128) DEFAULT '',
|
||||
tenant_desc varchar(256) DEFAULT NULL,
|
||||
create_source varchar(32) DEFAULT NULL,
|
||||
gmt_create bigint NOT NULL,
|
||||
gmt_modified bigint NOT NULL,
|
||||
constraint tenant_info_id_key PRIMARY KEY (id),
|
||||
constraint uk_tenant_info_kptenantid UNIQUE (kp,tenant_id));
|
||||
CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id);
|
||||
|
||||
CREATE TABLE users (
|
||||
username varchar(50) NOT NULL PRIMARY KEY,
|
||||
password varchar(500) NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT true
|
||||
);
|
||||
|
||||
CREATE TABLE roles (
|
||||
username varchar(50) NOT NULL,
|
||||
role varchar(50) NOT NULL,
|
||||
constraint uk_username_role UNIQUE (username,role)
|
||||
);
|
||||
|
||||
CREATE TABLE permissions (
|
||||
role varchar(50) NOT NULL,
|
||||
resource varchar(512) NOT NULL,
|
||||
action varchar(8) NOT NULL,
|
||||
constraint uk_role_permission UNIQUE (role,resource,action)
|
||||
);
|
||||
|
||||
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
@ -2,6 +2,8 @@ server:
|
||||
port: 8848 #如何修改 pig-register 启动端口 >: https://t.cn/A6XGvTdb
|
||||
tomcat:
|
||||
basedir: logs
|
||||
servlet:
|
||||
context-path: /nacos
|
||||
|
||||
db:
|
||||
num: 1
|
||||
|
1
pig-register/src/main/resources/conf/announcement.conf
Normal file
1
pig-register/src/main/resources/conf/announcement.conf
Normal file
@ -0,0 +1 @@
|
||||
无论您是多年编程的高级工程师,还是刚刚入门的实习生,部署请完全参考<a href="https://sourl.cn/WaiyBH">微服务开发平台部署手册</a>操作。
|
@ -1 +1 @@
|
||||
version=2.2.0
|
||||
version=2.2.4
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
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?711c34427bb0227d8941" 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?711c34427bb0227d8941"></script></body>
|
||||
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user