chore: initial commit of ai site platform
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
73
platform/internal/config/config.go
Normal file
73
platform/internal/config/config.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/rest"
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
DataSource string `json:",optional"`
|
||||
DryRun bool `json:",optional"`
|
||||
DevAuth bool `json:",default=true"`
|
||||
Auth AuthConf `json:",optional"`
|
||||
SMS SMSConf `json:",optional"`
|
||||
License LicenseConf `json:",optional"`
|
||||
Agent AgentConf `json:",optional"`
|
||||
PublicBaseURL string `json:",optional"`
|
||||
RateLimitPerMin int `json:",default=180"`
|
||||
Storage StorageConf `json:",optional"`
|
||||
DBSync DBSyncConf `json:",optional"`
|
||||
}
|
||||
|
||||
type AuthConf struct {
|
||||
AccessSecret string `json:",optional"`
|
||||
AccessExpire int64 `json:",default=86400"` // JWT 会话秒数;登录态时效,与授权到期无关
|
||||
IssueSecret string `json:",optional"`
|
||||
// PhoneLoginOnly:仅允许手机号登录。默认 false。
|
||||
// 若 License.Enabled(有部署期限控制),运行时会忽略本开关,允许用户名登录。
|
||||
PhoneLoginOnly bool `json:",optional"`
|
||||
// DisableUsernameLoginIfPhoneBound:已绑手机禁止用户名登录(账号级策略仍可单独禁用)。
|
||||
DisableUsernameLoginIfPhoneBound bool `json:",optional"`
|
||||
// RequirePhoneBound:无手机号不可登录。有 License 期限时通常不必开启。
|
||||
RequirePhoneBound bool `json:",optional"`
|
||||
}
|
||||
|
||||
// LicenseConf 客户机授权:每次续费/延期生成独立签名文件;运行时取目录中最新有效租约。
|
||||
type LicenseConf struct {
|
||||
Enabled bool `json:",optional"`
|
||||
Customer string `json:",optional"`
|
||||
LeaseDir string `json:",optional"` // 默认 ./data/license/leases;租约文件目录
|
||||
StateDir string `json:",optional"` // 默认 ./data/license/state;消费账本(与 leases 分离,防只删租约复用)
|
||||
LeasePath string `json:",optional"` // 兼容旧字段
|
||||
ControlSecret string `json:",optional"`
|
||||
SignSecret string `json:",optional"`
|
||||
SeedNotAfter string `json:",optional"`
|
||||
GraceDays int `json:",optional"`
|
||||
Message string `json:",optional"`
|
||||
NotAfter string `json:",optional"`
|
||||
// RedeemURL 可选:你们的核销服务根地址。配置后导入延期包必须联网核销 id(防删库清盘后复用旧包)。
|
||||
// POST {RedeemURL}/v1/license/redeem Body: {"id","customer","action":"redeem"}
|
||||
RedeemURL string `json:",optional"`
|
||||
}
|
||||
|
||||
// SMSConf 短信验证码。Provider=dev 时不真实发信,验证码写日志并可在接口返回 debug_code。
|
||||
type SMSConf struct {
|
||||
Provider string `json:",default=dev"` // dev | off
|
||||
CodeTTLSeconds int `json:",default=300"`
|
||||
ResendSeconds int `json:",default=60"`
|
||||
DevFixedCode string `json:",optional"` // 开发可固定如 123456
|
||||
}
|
||||
|
||||
type AgentConf struct {
|
||||
CapsuleSecret string `json:",optional"`
|
||||
RegisterSecret string `json:",optional"` // 宿主自注册防刷;空则回退 IssueSecret/AccessSecret
|
||||
}
|
||||
|
||||
type StorageConf struct {
|
||||
Driver string `json:",default=local"`
|
||||
LocalRoot string `json:",default=./data/uploads"`
|
||||
PublicBase string `json:",optional"` // 默认 PublicBaseURL + /api/v1/storage
|
||||
}
|
||||
|
||||
type DBSyncConf struct {
|
||||
Enabled bool `json:",default=true"`
|
||||
DataDir string `json:",default=./data/dbsync"` // 通道/冲突队列 JSON
|
||||
}
|
||||
Reference in New Issue
Block a user