Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildConfig ¶
func BuildConfig()
Types ¶
type AmapConfig ¶
type Config ¶
type Config struct {
Model struct {
Ark struct {
ModelId string `yaml:"modelId"` // ARK 模型ID
APIKey string `yaml:"apiKey"` // ARK 模型的 API Key
} `yaml:"ark"`
} `yaml:"model"`
MySQL MySQLConfig `yaml:"mysql"` // 嵌套MySQL配置
Log LogConfig `yaml:"log"` // 日志配置
Cors CorsConfig `yaml:"cors"` // 日志配置
JWT JWTConfig `yaml:"jwt"` // 日志配置
Redis RedisConfig `yaml:"redis"` // 日志配置
Task []TaskConfig `yaml:"task"` // 日志配置
Amap AmapConfig `yaml:"amap"` // 日志配置
}
Config 全局配置结构体(可根据项目扩展其他配置,如Redis、日志等)
var Cfg Config
Cfg 全局配置实例(供外部调用)
type LogConfig ¶
type LogConfig struct {
Level string `yaml:"level"` // 日志级别:debug/info/warn/error
Output string `yaml:"output"` // 输出方式:console/file/both
FileDir string `yaml:"file_dir"` // 日志文件目录(output为file/both时有效)
MaxSize int `yaml:"max_size"` // 单个文件最大大小(MB)
MaxBackups int `yaml:"max_backups"` // 保留备份文件数
MaxAge int `yaml:"max_age"` // 保留天数(天)
Compress bool `yaml:"compress"` // 是否压缩备份文件
}
LogConfig 日志配置参数
type MySQLConfig ¶
type MySQLConfig struct {
DSN string `yaml:"dsn"` // 连接字符串
MaxOpenConns int `yaml:"maxOpenConns"` // 最大打开连接数
MaxIdleConns int `yaml:"maxIdleConns"` // 最大空闲连接数
ConnMaxLifetime int `yaml:"connMaxLifetime"` // 连接最大存活时间(秒)
ConnMaxIdleTime int `yaml:"connMaxIdleTime"` // 连接最大空闲时间(秒)
}
MySQLConfig MySQL连接配置(包含连接池参数)
type RedisConfig ¶
Source Files
¶
- builder.go
- config.go
Click to show internal directories.
Click to hide internal directories.