Files
web_template/config.yaml

124 lines
3.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ========== 服务配置 ==========
server:
port: 8080
read_timeout: 15 # 读超时(秒)
write_timeout: 30 # 写超时(秒)
idle_timeout: 120 # 空闲超时(秒)
shutdown_timeout: 15 # 优雅关机等待时间(秒)
# ========== 数据库配置 ==========
database:
driver: sqlite # sqlite | mysql
auto_migrate: true # 自动建表/更新表结构,生产环境建议 false
init_data: true # 首次启动时是否初始化基础数据
# SQLite 配置
sqlite:
path: ./data/app.db
# MySQL 配置(切换时填写)
mysql:
host: 127.0.0.1
port: 3306
username: root
password: ""
database: app
charset: utf8mb4
max_idle_conns: 10
max_open_conns: 100
# ========== JWT 认证 ==========
jwt:
secret: "change-me-in-production"
expire_hours: 720 # Token 有效期(小时)
# ========== 文件上传 ==========
upload:
path: uploads
base_url: "" # 访问基础 URL,如 https://file.example.com
max_size: 10485760 # 10MB
allowed_types:
- image/jpeg
- image/png
- image/gif
- image/webp
- image/svg+xml
- image/x-icon
- image/bmp
- video/mp4
- video/webm
- application/pdf
# ========== 存储配置 ==========
# 支持 local / minio / cos 三种存储方式
# 开发环境用 local,正式环境按需选择
storage:
type: local # local | minio | cos
# 本地存储配置
local:
path: uploads
# MinIO 私有部署配置
minio:
endpoint: "127.0.0.1:9000"
access_key: ""
secret_key: ""
bucket: "myapp"
use_ssl: false
public_url: "http://127.0.0.1:9000"
auto_create_bucket: true
# 腾讯云 COS 配置
cos:
secret_id: ""
secret_key: ""
bucket: "your-bucket-1250000000"
region: ap-guangzhou
base_url: "https://your-bucket.cos.ap-guangzhou.myqcloud.com"
# ========== 短信服务 ==========
sms:
dev_mode: true # 开发模式:true=返回验证码不真实发送,false=真实发送
provider: mock # mock | aliyun | tencent
code_expire: 300 # 验证码有效期(秒)
send_interval: 60 # 发送间隔(秒),防刷
# 阿里云短信
aliyun:
access_key_id: ""
access_key_secret: ""
sign_name: ""
template_code: ""
# 腾讯云短信
tencent:
secret_id: ""
secret_key: ""
sign_name: ""
template_id: ""
app_id: ""
# ========== 微信配置 ==========
wechat:
app_id: ""
app_secret: ""
# 微信支付(可选,按需开启)
mch_id: ""
api_key: ""
notify_url: ""
# ========== AI 配置(可选) ==========
ai:
api_key: ""
api_type: "deepseek" # deepseek | openai
model: "deepseek-chat"
# ========== CORS 跨域 ==========
cors:
allowed_origins:
- "*" # 生产环境应限制为具体域名
# ========== API 限流 ==========
rate_limit:
enabled: true
requests_per_second: 10
burst_size: 20
# ========== 环境配置 ==========
env:
name: dev # dev | prod