feat(config): 更新项目配置以支持MySQL数据库和环境变量

- 添加docker环境变量配置文件包含数据库连接信息
- 更新前端环境变量中的API基础URL地址
- 修改后端应用配置以支持环境变量读取数据库配置
- 在Docker Compose中添加环境变量传递和env_file支持
- 配置生产环境下的MySQL数据源和MyBatis-Plus设置
- 添加服务器镜像导入和数据库用户创建说明文档
This commit is contained in:
ikmkj
2026-01-07 14:58:16 +08:00
parent a0991db83e
commit bd0188605d
7 changed files with 75 additions and 6 deletions

View File

@@ -14,8 +14,8 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://panel-jp.998521.xyz:37857/biji_db?useSSL=false&serverTimezone=UTC&characterEncoding=utf8
username: root
password: Ll@12331100
username: biji_user
password: Ll12331100
jpa:
hibernate:
ddl-auto: update

View File

@@ -1,5 +1,5 @@
spring:
# datasource:
datasource:
# driver-class-name: org.sqlite.JDBC
# url: jdbc:sqlite:/data/mydatabase.db
# jpa:
@@ -11,10 +11,35 @@ spring:
# format_sql: false
# dialect: org.hibernate.dialect.SQLiteDialect
# 上面是 默认配置数据库为sqlite下面是 配置mysql。从环境 变量中获取
driver-class-name: ${DB_DRIVER:com.mysql.cj.jdbc.Driver}
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect
# MyBatis-Plus配置
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration:
map-underscore-to-camel-case: true
global-config:
db-config:
logic-delete-field: isDeleted # 全局逻辑删除的实体字段名
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
# 禁用Knife4j
knife4j:
enable: false

View File

@@ -1,4 +1,11 @@
server:
port: 8084
forward-headers-strategy: framework
spring:
web:
nginx:
https-forward-headers: true
application:
name: biji-houdaun
profiles:
@@ -12,8 +19,6 @@ file:
#??
server:
port: 8084
## Snowflake ID?????