diff --git a/.gitignore b/.gitignore
index b6d208a..36367b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,11 +48,9 @@ application-test.yml
application-prod.yml
bootstrap.yml
-# conf 目录下的实际配置文件(敏感信息)
-# 开发阶段:src/main/resources/conf/
-# 部署阶段:conf/(打包后)
-src/main/resources/conf/env.properties
-src/main/resources/conf/service.properties
+# 实际配置文件(敏感信息,仅模板提交)
+src/main/resources/env.properties
+src/main/resources/service.properties
# 数据库备份
*.sql.backup
diff --git a/doc/架构设计文档.md b/doc/架构设计文档.md
index 8579294..04ccb58 100644
--- a/doc/架构设计文档.md
+++ b/doc/架构设计文档.md
@@ -958,7 +958,7 @@ worklog-api/
```
**说明**:
-- 开发阶段:配置文件在 `src/main/resources/conf/` 目录,跟随源码管理
+- 开发阶段:配置文件直接在 `src/main/resources/` 目录下,跟随源码管理
- 部署阶段:通过 Maven Assembly 插件打包后,配置文件输出到 `conf/` 目录,位于应用根目录
开发环境配置文件结构:
@@ -966,8 +966,13 @@ worklog-api/
```text
src/main/resources/
├── application.yml # 主配置文件(Spring Boot 配置)
+├── application.yml.example # 主配置模板
├── bootstrap.yml # 启动配置(Nacos 配置中心,可选)
-└── logback-spring.xml # 日志配置(从环境变量读取参数)
+├── logback-spring.xml # 日志配置(从环境变量读取参数)
+├── env.properties # 统一环境配置(敏感信息,不提交)
+├── env.properties.example # 环境配置模板
+├── service.properties # 服务个性化配置(敏感信息,不提交)
+└── service.properties.example # 服务配置模板
```
##### 9.4.5.2 配置加载顺序
diff --git a/doc/配置规范落地说明.md b/doc/配置规范落地说明.md
index aeeec61..4ace534 100644
--- a/doc/配置规范落地说明.md
+++ b/doc/配置规范落地说明.md
@@ -10,10 +10,10 @@
**新增配置文件**:
-- [`src/main/resources/conf/env.properties`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/conf/env.properties) - 统一环境配置(所有服务共用)
-- [`src/main/resources/conf/service.properties`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/conf/service.properties) - 服务个性化配置
-- [`src/main/resources/conf/env.properties.example`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/conf/env.properties.example) - 环境配置模板
-- [`src/main/resources/conf/service.properties.example`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/conf/service.properties.example) - 服务配置模板
+- [`src/main/resources/env.properties`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/env.properties) - 统一环境配置(所有服务共用)
+- [`src/main/resources/service.properties`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/service.properties) - 服务个性化配置
+- [`src/main/resources/env.properties.example`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/env.properties.example) - 环境配置模板
+- [`src/main/resources/service.properties.example`](file:///home/along/MyCode/wanjiabuluo/worklog/worklog-api/src/main/resources/service.properties.example) - 服务配置模板
**配置内容说明**:
@@ -117,9 +117,9 @@
**新增忽略项**:
```gitignore
-# conf 目录下的实际配置文件(敏感信息)
-worklog-api/src/main/resources/conf/env.properties
-worklog-api/src/main/resources/conf/service.properties
+# 实际配置文件(敏感信息,仅模板提交)
+src/main/resources/env.properties
+src/main/resources/service.properties
```
**安全策略**:
@@ -153,17 +153,18 @@ worklog-api/src/main/resources/conf/service.properties
```text
worklog-api/src/main/resources/
-├── conf/ # 配置文件目录(开发阶段)
-│ ├── env.properties # 统一环境配置
-│ ├── service.properties # 服务个性化配置
-│ ├── env.properties.example # 环境配置模板
-│ └── service.properties.example # 服务配置模板
-├── bootstrap.yml # 启动配置(新增)
-└── logback-spring.xml # 更新:增强日志配置
+├── application.yml # 主配置文件
+├── application.yml.example # 主配置模板
+├── bootstrap.yml # 启动配置(新增)
+├── logback-spring.xml # 更新:增强日志配置
+├── env.properties # 统一环境配置(敏感信息,不提交)
+├── env.properties.example # 环境配置模板
+├── service.properties # 服务个性化配置(敏感信息,不提交)
+└── service.properties.example # 服务配置模板
-deploy/ # 项目根目录
+deploy/ # 项目根目录
└── scripts/
- └── status.sh # 新增:状态查看脚本
+ └── status.sh # 新增:状态查看脚本
```
**部署阶段**(打包后):
diff --git a/worklog-api/src/main/assembly/assembly.xml b/worklog-api/src/main/assembly/assembly.xml
index f248265..7859f7b 100644
--- a/worklog-api/src/main/assembly/assembly.xml
+++ b/worklog-api/src/main/assembly/assembly.xml
@@ -42,33 +42,17 @@
unix
-
-
- ${project.basedir}/src/main/resources/conf
- conf
-
- *.properties
- *.example
-
-
-
-
+
${project.basedir}/src/main/resources
conf
application.yml
+ application.yml.example
bootstrap.yml
logback-spring.xml
-
-
-
-
-
- ${project.basedir}/../deploy/scripts
- conf
-
- *.example
+ env.properties.example
+ service.properties.example
diff --git a/worklog-api/src/main/resources/conf/env.properties.example b/worklog-api/src/main/resources/conf/env.properties.example
deleted file mode 100644
index c8b1ce4..0000000
--- a/worklog-api/src/main/resources/conf/env.properties.example
+++ /dev/null
@@ -1,38 +0,0 @@
-# ====================================================
-# 统一环境配置文件模板
-# ====================================================
-# 说明:
-# 1. 复制此文件为 env.properties 并填入实际值
-# 2. 此文件包含环境敏感配置,不提交到版本控制
-# ====================================================
-
-# ==================== 数据库配置 ====================
-DB_HOST=localhost
-DB_PORT=3306
-DB_NAME=worklog
-DB_USER=worklog
-DB_PASSWORD=Wlog@123
-
-# ==================== Redis 配置 ====================
-REDIS_HOST=localhost
-REDIS_PORT=6379
-REDIS_PASSWORD=zjf@123456
-REDIS_DATABASE=0
-
-# ==================== Nacos 配置(可选)====================
-NACOS_SERVER_ADDR=localhost:8848
-NACOS_NAMESPACE=worklog-dev
-NACOS_GROUP=DEFAULT_GROUP
-NACOS_USERNAME=nacos
-NACOS_PASSWORD=nacos
-
-# ==================== JVM 配置 ====================
-JVM_XMS=512m
-JVM_XMX=1024m
-JVM_METASPACE_SIZE=128m
-JVM_MAX_METASPACE_SIZE=256m
-JVM_GC_TYPE=G1GC
-JVM_MAX_GC_PAUSE_MILLIS=200
-
-# ==================== Spring 配置 ====================
-SPRING_PROFILES_ACTIVE=prod
diff --git a/worklog-api/src/main/resources/conf/service.properties.example b/worklog-api/src/main/resources/conf/service.properties.example
deleted file mode 100644
index a282028..0000000
--- a/worklog-api/src/main/resources/conf/service.properties.example
+++ /dev/null
@@ -1,38 +0,0 @@
-# ====================================================
-# 服务个性化配置文件模板
-# ====================================================
-# 说明:
-# 1. 复制此文件为 service.properties 并根据需要修改
-# 2. 此文件优先级高于 env.properties
-# 3. 用于覆盖默认配置或添加服务特定配置
-# ====================================================
-
-# ==================== Token 配置 ====================
-# Token 有效期(秒),默认 24 小时
-TOKEN_EXPIRE_TIME=86400
-
-# Token 在 Redis 中的 Key 前缀
-TOKEN_PREFIX=auth:token:
-
-# ==================== 日志配置 ====================
-# 日志内容最大长度(汉字)
-LOG_MAX_CONTENT_LENGTH=2000
-
-# ==================== 文件上传配置 ====================
-# 是否启用本地文件上传
-UPLOAD_ENABLED=true
-# 上传文件存储路径
-UPLOAD_BASE_PATH=./uploads
-# 最大文件大小
-UPLOAD_MAX_FILE_SIZE=10MB
-# 允许的文件扩展名
-UPLOAD_ALLOWED_EXTENSIONS=jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx
-
-# ==================== 腾讯云 COS 配置(可选)====================
-COS_ENABLED=false
-COS_APP_ID=1308258046
-COS_SECRET_ID=
-COS_SECRET_KEY=
-COS_BUCKET_NAME=
-COS_BUCKET_HOST=
-COS_REGION=ap-beijing