first commit

This commit is contained in:
2026-02-13 15:57:29 +08:00
commit aacda0b66a
53 changed files with 10029 additions and 0 deletions

33
config/development.toml Normal file
View File

@@ -0,0 +1,33 @@
# 开发环境配置 - SQLite 数据库
[server]
host = "0.0.0.0"
port = 3000
[database]
# 数据库类型: mysql, sqlite, postgresql
database_type = "sqlite"
# MySQL/PostgreSQL 配置
# host = "localhost"
# port = 3306
# user = "root"
# password = "root"
# database = "web_template"
# SQLite 配置(当 database_type = "sqlite" 时使用)
path = "data/app.db"
# 连接池配置
max_connections = 10
[auth]
jwt_secret = "9f7d3c7a564dfkopp26smb2644nqzfvbsao9f7d3c7a1a8f28544b5e6d7a"
# 分开配置两个 token 的过期时间
access_token_expiration_minutes = 15 # access_token 15 分钟
refresh_token_expiration_days = 7 # refresh_token 7 天
[redis]
host = "localhost"
port = 6379
password = "" # 可选
db = 0

33
config/production.toml Normal file
View File

@@ -0,0 +1,33 @@
# 生产环境配置 - PostgreSQL 数据库
[server]
host = "0.0.0.0" # 服务器监听地址0.0.0.0=允许所有网络访问)
port = 3000 # 服务器监听端口(确保防火墙已开放)
[database]
database_type = "postgresql" # 数据库类型sqlite/mysql/postgresql
host = "localhost" # PostgreSQL 服务器地址
port = 5432 # PostgreSQL 端口(默认 5432
user = "postgres" # PostgreSQL 用户名(请创建专用用户)
password = "postgres" # PostgreSQL 密码(请修改为强密码)
database = "web_template" # 数据库名称(不存在会自动创建)
max_connections = 20 # 最大连接数(生产环境建议 20-100
[auth]
jwt_secret = "9f7d3c7a564dfkopp26smb2644nqzfvbsao9f7d3c7a1a8f28544b5e6d7a" # JWT 签名密钥(必须修改为强随机字符串!)
access_token_expiration_minutes = 15 # Access Token 过期时间(分钟)
refresh_token_expiration_days = 7 # Refresh Token 过期时间(天)
[redis]
host = "localhost" # Redis 服务器地址
port = 6379 # Redis 端口(默认 6379
password = "" # Redis 密码(强烈建议设置密码)
db = 0 # Redis 数据库编号0-15
# 安全检查清单:部署前请确认
# ✅ 1. 已修改 jwt_secret 为强随机字符串
# ✅ 2. 已修改数据库密码为强密码
# ✅ 3. 已设置 Redis 密码
# ✅ 4. 已配置防火墙规则
# ✅ 5. 已启用 HTTPS使用 Nginx/Caddy 等反向代理)
# ✅ 6. 已设置数据库定期备份