Files
mce/config.yaml
Victor_Jay 2449a27eb5
Some checks failed
CI / Lint + Build (push) Has been cancelled
refactor: CSP nonce替代unsafe-inline, HSTS始终启用, router/api拆分, 管理后台+用户设置页拆分, DB健康降级, 时区配置, UID统一解析, CI接入
审计修复:
- CSP: unsafe-inline移除, nonce替代; unsafe-eval保留供Vditor使用
- HSTS: 始终启用(不再依赖release模式)
- Controller Exp: common.GetGinExp包装, 不再直接读context
- UID解析: common.ParseUIDParam统一, follow/admin controller改用

重构:
- router/api.go(198行)拆为7个域文件: auth/settings/posts/comments/reactions/social/studio
- 管理后台站点设置: 单页拆为4个子页(brand/security/registration/content)+子菜单
- 前台用户设置页: 1201行拆为6个独立模板+6个独立JS文件

新增:
- DB健康检测中间件(middleware/db_health.go): 5s ping+降级页面
- 时区配置: config.yaml server.timezone→time.Local初始化
- .gitea/workflows/ci.yml: strict模式CI流水线
2026-06-22 03:06:24 +08:00

67 lines
2.3 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.

# MetaZone.FAN 默认配置
# 敏感值通过环境变量或 .env 覆盖
server:
port: 8080
mode: debug # debug | release | test
cookie_secure: false # Cookie Secure 标志(生产环境应设为 true部分反向代理环境下可能需要灵活控制
timezone: Asia/Shanghai # 时区(影响 time.Now() 和模板时间格式化)
database:
host: 127.0.0.1
port: 5432
user: metazone
password: "" # 敏感值由 .env 注入
dbname: metalab_dev
sslmode: disable
# 会话配置(服务端 Session滑动窗口续期
# 每次请求自动续期,解决"记住我"掉线问题
session:
idle_timeout: 120 # 不记住我空闲超时分钟120 = 2 小时
remember_timeout: 43200 # 记住我:空闲超时(分钟),默认 43200 = 30 天
cleanup_interval: 300 # 后台清理过期会话间隔(秒),默认 300仅内存模式使用
# Redis 配置可选enabled: false 时使用内存存储)
redis:
enabled: true # 是否启用 Redis 存储会话
host: 127.0.0.1
port: 6379
password: "" # 敏感值由 .env 注入
db: 0
bcrypt:
cost: 12
# 站点设置(运行时通过管理后台 /admin/site-settings 配置DB持久化+内存缓存,无需重启)
# site.framework 页脚附加标识,默认 "Framework: MetaZone",留空则隐藏
# site.copyright_start 版权起始年,默认 "2024"
# registration.enabled 是否允许新用户注册,默认 true
# audit.* 审核系统配置,可运行时覆盖本文件默认值
audit:
enabled: true # 审核总开关
username_audit: true # 用户名修改审核
avatar_audit: true # 头像修改审核
bio_audit: true # 个性签名审核
# 角色配置(可扩展,无需修改源代码)
roles:
# 角色层级(数字越大权限越高)
levels:
user: 0
moderator: 1
admin: 2
owner: 3
# 角色显示名称
names:
user: "普通用户"
moderator: "版主"
admin: "管理员"
owner: "站长"
# 角色权限规则
permissions:
# 可操作的目标角色(未在此列出的角色默认可操作所有角色)
operable_roles:
admin: ["user"]
moderator: ["user"]