refactor: reorganize modules and add Linux build tooling

This commit is contained in:
2026-08-09 12:41:08 +08:00
parent 86024fa81d
commit 5cc5fd92ed
1461 changed files with 4054 additions and 4724 deletions

View File

@@ -0,0 +1,41 @@
package config
import (
"git.apinb.com/bsm-sdk/core/conf"
)
var (
Spec SrvConfig
)
type SrvConfig struct {
conf.Base `yaml:",inline"`
Databases *conf.DBConf `yaml:"Databases"` // 数据库配置
Rpc map[string]conf.RpcConf `yaml:"Rpc"` // RPC配置
Apm *conf.ApmConf `yaml:"APM"` // APM配置
Etcd *conf.EtcdConf `yaml:"Etcd"` // ETCD配置
MinioOss *conf.OssConf `yaml:"MinioOss"` // OSS配置
Local *LocalConf `yaml:"Local"` // 本地文件配置
FtsConfig *ftsConf `yaml:"FtsConfig"` // FTS配置
}
type ftsConf struct {
MaxSize int64 `yaml:"MaxSize"` // 上传文件大小限制
InputKey string `yaml:"InputKey"` // 上传文件名
Allows []string `yaml:"Allows"` // 允许上传的文件类型
}
type LocalConf struct {
Site string `yaml:"Site"` // 站点HOST
UploadDir string `yaml:"UploadDir"` //本地上传文件夹
}
func New(srvKey string) {
// 初始化配置 创建一个新的配置实例,用于服务配置
conf.New(srvKey, &Spec)
// 配置校验 服务端口如果不合规,则随机分配端口
Spec.Port = conf.CheckPort(Spec.Port)
// 配置校验 服务名称地址及监听地址不能为空
conf.NotNil(Spec.Service, Spec.Cache)
}