mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-23 13:03:42 +08:00
✨ close #I6AIC7 pigx-register支持开启认证模式
This commit is contained in:
parent
c48bc207ea
commit
56751368d4
@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
@ -43,7 +43,7 @@ public class PigNacosApplication {
|
||||
*/
|
||||
private static boolean initEnv() {
|
||||
System.setProperty(ConfigConstants.STANDALONE_MODE, "true");
|
||||
System.setProperty(ConfigConstants.AUTH_ENABLED, "false");
|
||||
System.setProperty(ConfigConstants.AUTH_ENABLED, "true");
|
||||
System.setProperty(ConfigConstants.LOG_BASEDIR, "logs");
|
||||
System.setProperty(ConfigConstants.LOG_ENABLED, "false");
|
||||
return true;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package com.alibaba.nacos.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.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
@ -39,7 +40,7 @@ import java.time.ZoneId;
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@PropertySource("/application.properties")
|
||||
@PropertySource("/application.yml")
|
||||
public class ConsoleConfig {
|
||||
|
||||
@Autowired
|
||||
@ -64,11 +65,18 @@ public class ConsoleConfig {
|
||||
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());
|
||||
|
@ -2,6 +2,8 @@ server:
|
||||
port: 8848 #如何修改 pig-register 启动端口 >: https://t.cn/A6XGvTdb
|
||||
tomcat:
|
||||
basedir: logs
|
||||
error:
|
||||
include-message: always
|
||||
|
||||
db:
|
||||
num: 1
|
||||
@ -14,12 +16,15 @@ db:
|
||||
nacos:
|
||||
core:
|
||||
auth:
|
||||
server:
|
||||
identity:
|
||||
key: serverIdentity
|
||||
value: security
|
||||
plugin.nacos.token.secret.key: SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||
enabled: false
|
||||
system.type: nacos
|
||||
security:
|
||||
ignore:
|
||||
urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||
urls: /actuator/**,/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
|
@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
@ -12,6 +12,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
|
||||
metadata:
|
||||
|
Loading…
Reference in New Issue
Block a user