This repository has been archived on 2026-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
Files
MetaLab/config.yaml
Victor_Jay d6d03a7c3c feat: 实现 Redis 会话存储,支持内存/Redis 双模式自动切换
- 新增 go-redis/v9 依赖
- 新增 config.yaml redis 配置段 + RedisConfig 结构体 + REDIS_PASSWORD 环境变量覆盖
- 新增 common/redis.go Redis 客户端初始化
- 完整实现 session/redis_store.go,实现 Store 接口全部 7 个方法
- Redis TTL 自动过期,无须后台清理 goroutine
- deps_core.go 根据 cfg.Redis.Enabled 自动选择 RedisStore/MemoryStore
- router.go + main.go 透传 redisClient 参数
2026-05-31 11:28:27 +08:00

65 lines
2.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.

# MetaZone.FAN 默认配置
# 敏感值通过环境变量或 .env 覆盖
server:
port: 8080
mode: debug # debug | release | test
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: false # 是否启用 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"]