生成环境禁用doc相关接口
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
- **技术栈**:Java 17 + Spring Boot 3.3.2 + Spring Security 6 + MyBatis-Plus 3.5.7
|
||||
- **构建工具**:Maven(单模块 POM)
|
||||
- **应用入口**:`com.ichangzuo.iczApplication`
|
||||
- **默认端口**:8989(dev/test)/ 9999(prod)
|
||||
- **默认端口**:8989(dev)/ 9999(prod)
|
||||
- **接口文档**:启动后访问 `http://localhost:8989/doc.html`(Knife4j)
|
||||
|
||||
## 运行环境依赖
|
||||
@@ -16,10 +16,9 @@
|
||||
- **Redis**:端口 16378,开发环境密码 `CZwy168`
|
||||
- **运行时 Profile**:
|
||||
- `dev`(默认):本地开发
|
||||
- `test`:测试环境(数据库 `192.168.5.2`)
|
||||
- `prod`:生产环境
|
||||
|
||||
> 注意:`application.yml` 中默认激活的是 `prod`,但 Maven 的 `dev` profile 是默认激活的。
|
||||
> 注意:`application.yml` 中默认激活的是 `prod`,但 spring-boot-maven-plugin 已配置 `<profiles>` 传递,`mvn spring-boot:run -P dev` 会实际激活 `dev` profile(默认也是 dev)。
|
||||
|
||||
## 常用命令
|
||||
|
||||
@@ -30,9 +29,6 @@ mvn spring-boot:run -P dev
|
||||
# 打包(默认 dev)
|
||||
mvn clean package
|
||||
|
||||
# 测试环境打包
|
||||
mvn clean package -P test
|
||||
|
||||
# 生产环境打包
|
||||
mvn clean package -P prod
|
||||
|
||||
@@ -108,4 +104,4 @@ src/main/java/com/ichangzuo/
|
||||
2. **MapStruct**:项目使用 MapStruct 进行实体转换,配合 Lombok 使用,需确保 `lombok-mapstruct-binding` 依赖存在
|
||||
3. **Undertow 替代 Tomcat**:`spring-boot-starter-tomcat` 被排除,使用 `spring-boot-starter-undertow`
|
||||
4. **打包配置**:`spring-boot-maven-plugin` 配置了 `ZIP` layout,并排除了 Lombok
|
||||
5. **Maven Profile 优先级**:`dev` profile 默认激活,但 Spring 的 `application.yml` 默认激活 `prod`。实际运行时以 Spring 的 `spring.profiles.active` 为准
|
||||
5. **Profile 传递**:spring-boot-maven-plugin 配置了 `<profiles>`,把 Maven 的 `spring.profiles.active` 属性传给 fork 的 JVM。`mvn spring-boot:run` 默认激活 `dev`,`-P prod` 激活 `prod`。注意:打包产物(`java -jar`)仍以 `application.yml` 硬编码的 `prod` 为默认,生产部署不受影响
|
||||
|
||||
@@ -62,7 +62,6 @@ src/main/java/com/ichangzuo/
|
||||
- **Redis**:端口 16378
|
||||
- **运行时 Profile**:
|
||||
- `dev`(默认):本地开发
|
||||
- `test`:测试环境
|
||||
- `prod`:生产环境
|
||||
|
||||
## 快速开始
|
||||
@@ -91,9 +90,6 @@ mvn spring-boot:run -P dev
|
||||
# 打包(默认 dev)
|
||||
mvn clean package
|
||||
|
||||
# 测试环境打包
|
||||
mvn clean package -P test
|
||||
|
||||
# 生产环境打包
|
||||
mvn clean package -P prod
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.ichangzuo</groupId>
|
||||
<artifactId>server-java</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>2.2</version>
|
||||
<description>基于 Java 17 + SpringBoot 3 + Spring Security 构建的唱作网系统。</description>
|
||||
|
||||
<parent>
|
||||
@@ -20,6 +20,9 @@
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
||||
<!-- 默认激活的 Spring profile(Maven -P dev/prod 可覆盖) -->
|
||||
<spring.profiles.active>dev</spring.profiles.active>
|
||||
|
||||
<hutool.version>5.8.27</hutool.version>
|
||||
|
||||
<mysql.version>8.0.28</mysql.version>
|
||||
@@ -302,15 +305,6 @@
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test</id>
|
||||
<properties>
|
||||
<spring.profiles.active>test</spring.profiles.active>
|
||||
</properties>
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}-test</finalName>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
@@ -329,12 +323,15 @@
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<layout>ZIP</layout>
|
||||
<!-- <includes>
|
||||
<profiles>
|
||||
<profile>${spring.profiles.active}</profile>
|
||||
</profiles>
|
||||
<includes>
|
||||
<include>
|
||||
<groupId>nothing</groupId>
|
||||
<artifactId>nothing</artifactId>
|
||||
</include>
|
||||
</includes> -->
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
||||
@@ -240,3 +240,25 @@ polling:
|
||||
fixed-delay: 10000
|
||||
batch-size: 2
|
||||
|
||||
# 安全配置:覆盖 application.yml 的 security.ignore-urls(同名列表整体替换,不合并)
|
||||
# 仅开发环境放行测试用接口(style/notice/statistics/rag)和接口文档,生产环境走 application.yml 的收紧列表
|
||||
security:
|
||||
ignore-urls:
|
||||
- /v3/api-docs/**
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /webjars/**
|
||||
- /swagger-ui/**
|
||||
- /swagger-ui.html
|
||||
- /api/v1/auth/captcha
|
||||
- /api/v1/auth/verifyRegCode
|
||||
- /api/v1/users/resetPassword
|
||||
- /api/v1/software/**
|
||||
- /api/v1/helper/**
|
||||
- /api/v1/style/**
|
||||
- /api/v1/notice/**
|
||||
- /api/v1/statistics/**
|
||||
- /api/v1/rag/**
|
||||
- /client/**
|
||||
- /ws/**
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ knife4j:
|
||||
# 是否开启 Knife4j 增强功能
|
||||
enable: true # 设置为 true 表示开启增强功能
|
||||
# 生产环境配置
|
||||
production: false # 设置为 true 表示在生产环境中不显示文档,为 false 表示显示文档(通常在开发环境中使用)
|
||||
production: true # 设置为 true 表示在生产环境中不显示文档,为 false 表示显示文档(通常在开发环境中使用)
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
@@ -231,5 +231,5 @@ rag:
|
||||
read-timeout: 120000
|
||||
batch-size: 20
|
||||
enabled: true
|
||||
export-path: ./qna-export
|
||||
export-path: /opt/iChangzuo/ragservice/qna-export
|
||||
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
server:
|
||||
port: 8989
|
||||
|
||||
web:
|
||||
resource-path: /opt/iChangzuo/File/
|
||||
|
||||
spring:
|
||||
jackson:
|
||||
## 默认序列化时间格式
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
## 默认序列化时区
|
||||
time-zone: GMT+8
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.5.2:3306/music?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: 168soft.xyz
|
||||
data:
|
||||
redis:
|
||||
database: 1
|
||||
host: 192.168.5.2
|
||||
port: 16378
|
||||
password: CZwy168
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数 默认8 ,负数表示没有限制
|
||||
max-active: 8
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认-1
|
||||
max-wait: -1
|
||||
# 连接池中的最大空闲连接 默认8
|
||||
max-idle: 8
|
||||
# 连接池中的最小空闲连接 默认0
|
||||
min-idle: 0
|
||||
cache:
|
||||
enabled: false
|
||||
# 缓存类型 redis、none(不使用缓存)
|
||||
type: redis
|
||||
# 缓存时间(单位:ms)
|
||||
redis:
|
||||
time-to-live: 3600000
|
||||
# 缓存null值,防止缓存穿透
|
||||
cache-null-values: true
|
||||
#邮件配置
|
||||
mail1: #腾讯企业邮箱
|
||||
default-encoding: UTF-8
|
||||
host: smtp.exmail.qq.com
|
||||
port: 465 #587
|
||||
username: music@qq.ichangzuo.com
|
||||
password: HriXz8MjvuETpSt2
|
||||
# 使用的协议
|
||||
protocol: smtps
|
||||
# 其他的属性
|
||||
properties:
|
||||
mail:
|
||||
debug: true
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
# 邮件发送者
|
||||
from: 唱作网<music@qq.ichangzuo.com>
|
||||
mail: #网易企业邮箱
|
||||
default-encoding: UTF-8
|
||||
host: smtp.ym.163.com #hwhkhm.qiye.163.com #smtphz.qiye.163.com #
|
||||
port: 465 #994
|
||||
protocol: smtps
|
||||
username: music@ichangzuo.com
|
||||
password: 2885451900musi
|
||||
properties: # 配置以SSL的方式发送, 这个需要使用这种方式并且端口是465
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
# 邮件发送者
|
||||
from: 唱作网<music@ichangzuo.com>
|
||||
|
||||
# 短信配置
|
||||
sms:
|
||||
# 阿里云短信
|
||||
aliyun:
|
||||
accessKeyId: LTAI5tJRg7a9CnswDbWJyR6p
|
||||
accessKeySecret: aogSE7QorrQfEUdE8pRTd91LRL9Zqq
|
||||
domain: dysmsapi.aliyuncs.com
|
||||
regionId: cn-chengdu
|
||||
signName: 唱作网
|
||||
templateCodes:
|
||||
# 注册
|
||||
register: SMS_477535088
|
||||
# 绑定
|
||||
bindMobile: SMS_477555084
|
||||
# 修改密码
|
||||
resetPassword: SMS_477505073
|
||||
|
||||
pay:
|
||||
ali:
|
||||
sandBox: true
|
||||
notifyUrl: http://www.iChangzuo.com/client/alipayOrderNotify
|
||||
returnUrl: http://www.iChangzuo.com/account/notes/trade
|
||||
wx:
|
||||
appNotifyUrl: http://www.iChangzuo.com/client/wxpayAppOrderNotify
|
||||
webNotifyUrl: http://www.iChangzuo.com/client/wxpayWebOrderNotify
|
||||
appPrivateKeyPath: /opt/iChangzuo/ssl/1266239101/
|
||||
webPrivateKeyPath: /opt/iChangzuo/ssl/1250765101/
|
||||
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
# 主键ID类型
|
||||
id-type: none
|
||||
# 逻辑删除字段名称
|
||||
logic-delete-field: is_deleted
|
||||
# 逻辑删除-删除值
|
||||
logic-delete-value: 1
|
||||
# 逻辑删除-未删除值
|
||||
logic-not-delete-value: 0
|
||||
configuration:
|
||||
# 驼峰下划线转换
|
||||
map-underscore-to-camel-case: true
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
|
||||
# 文件存储配置
|
||||
oss:
|
||||
# OSS 类型 (目前支持aliyun、minio)
|
||||
type: minio
|
||||
# MinIO 对象存储服务
|
||||
minio:
|
||||
# 服务Endpoint
|
||||
endpoint: http://localhost:9000
|
||||
# 访问凭据
|
||||
access-key: minioadmin
|
||||
# 凭据密钥
|
||||
secret-key: minioadmin
|
||||
# 存储桶名称
|
||||
bucket-name: public
|
||||
# (可选)自定义域名,如果配置了域名,生成的文件URL是域名格式,未配置则URL则是IP格式 (eg: https://oss.youlai.tech)
|
||||
custom-domain:
|
||||
# 阿里云OSS对象存储服务
|
||||
aliyun:
|
||||
# 服务Endpoint
|
||||
endpoint: oss-cn-hangzhou.aliyuncs.com
|
||||
# 访问凭据
|
||||
access-key-id: your-access-key-id
|
||||
# 凭据密钥
|
||||
access-key-secret: your-access-key-secret
|
||||
# 存储桶名称
|
||||
bucket-name: default
|
||||
|
||||
# springdoc配置: https://springdoc.org/properties.html
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
operationsSorter: alpha
|
||||
tags-sorter: alpha
|
||||
api-docs:
|
||||
path: /v3/api-docs
|
||||
group-configs:
|
||||
- group: '系统管理'
|
||||
paths-to-match: "/**"
|
||||
packages-to-scan:
|
||||
- com.ichangzuo.system.controller
|
||||
- com.ichangzuo.module.auth.controller
|
||||
- com.ichangzuo.module.file.controller
|
||||
- com.ichangzuo.module.generator.controller
|
||||
default-flat-param-object: true
|
||||
|
||||
# knife4j 接口文档配置
|
||||
knife4j:
|
||||
# 是否开启 Knife4j 增强功能
|
||||
enable: true # 设置为 true 表示开启增强功能
|
||||
# 生产环境配置
|
||||
production: false # 设置为 true 表示在生产环境中不显示文档,为 false 表示显示文档(通常在开发环境中使用)
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
# xxl-job 定时任务配置
|
||||
xxl:
|
||||
job:
|
||||
# 定时任务开关
|
||||
enabled: false
|
||||
admin:
|
||||
# 多个地址使用,分割
|
||||
addresses: http://127.0.0.1:8080/xxl-job-admin
|
||||
accessToken: default_token
|
||||
executor:
|
||||
appname: xxl-job-executor-${spring.application.name}
|
||||
address:
|
||||
ip:
|
||||
port: 9998
|
||||
logpath: /data/applogs/xxl-job/jobhandler
|
||||
logretentiondays: 30
|
||||
|
||||
# 验证码配置
|
||||
captcha:
|
||||
# 验证码类型 circle-圆圈干扰验证码|gif-Gif验证码|line-干扰线验证码|shear-扭曲干扰验证码
|
||||
type: circle
|
||||
# 验证码宽度
|
||||
width: 120
|
||||
# 验证码高度
|
||||
height: 40
|
||||
# 验证码干扰元素个数
|
||||
interfere-count: 2
|
||||
# 文本透明度(0.0-1.0)
|
||||
text-alpha: 0.8
|
||||
# 验证码字符配置
|
||||
code:
|
||||
# 验证码字符类型 math-算术|random-随机字符|number-随机数字
|
||||
type: number
|
||||
# 验证码字符长度,type=算术时,表示运算位数(1:个位数运算 2:十位数运算);type=随机字符时,表示字符个数
|
||||
length: 4
|
||||
# 验证码字体
|
||||
font:
|
||||
# 字体名称 Dialog|DialogInput|Monospaced|Serif|SansSerif
|
||||
name: SansSerif
|
||||
# 字体样式 0-普通|1-粗体|2-斜体
|
||||
weight: 1
|
||||
# 字体大小
|
||||
size: 20
|
||||
# 验证码有效期(秒)
|
||||
expire-seconds: 120
|
||||
|
||||
# RAG 配置
|
||||
rag:
|
||||
base-url: http://localhost:8990/py
|
||||
connect-timeout: 5000
|
||||
read-timeout: 120000
|
||||
batch-size: 20
|
||||
enabled: true
|
||||
export-path: ./qna-export
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
max-file-size: 500MB
|
||||
max-request-size: 500MB
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
|
||||
# 安全配置
|
||||
security:
|
||||
@@ -18,22 +18,11 @@ security:
|
||||
ttl: 86400
|
||||
# 白名单列表
|
||||
ignore-urls:
|
||||
- /v3/api-docs/**
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /webjars/**
|
||||
- /doc.html
|
||||
- /swagger-ui/**
|
||||
- /swagger-ui.html
|
||||
- /api/v1/auth/captcha
|
||||
- /api/v1/auth/verifyRegCode
|
||||
- /api/v1/users/resetPassword
|
||||
- /api/v1/software/**
|
||||
- /api/v1/helper/**
|
||||
- /api/v1/style/**
|
||||
- /api/v1/notice/**
|
||||
- /api/v1/statistics/**
|
||||
- /api/v1/rag/**
|
||||
- /client/**
|
||||
- /ws/**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user