Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
System SysConfig `json:"system"` // 应用系统配置
Log LogConfig `json:"log"` // 日志配置
Databases []Databases `json:"databases"` // 数据库配置
Cache Cache `json:"cache"` // 缓存配置
Redis []Redis `json:"redis"` // Redis 配置
Monitor Monitor `json:"monitor"` // 监控配置
Feishu Feishu `json:"feishu"` // 飞书配置
Collector Collector `json:"collector"` // 日志采集器配置
}
func LoadConfig ¶
type Databases ¶
type Databases struct {
Enable bool `json:"enable"` // 开关
DbType string `json:"db_type"` // 类型
DbHost string `json:"db_host"` // HOST
DbName string `json:"db_name"` // 数据库名称
DbUsername string `json:"db_username,omitempty"` // 数据库用户名
DbPassword string `json:"db_password,omitempty"` // 数据库用户密码
DbMaxIdleConn int `json:"db_max_idle_conn,omitempty"` // 空闲连接池中连接的最大数量
DbMaxOpenConn int `json:"db_max_open_conn,omitempty"` // 数据库连接的最大数量
DbMaxLifetime time.Duration `json:"db_max_lifetime,omitempty"` // 连接可复用的最大时间(单位:小时)
}
type Monitor ¶
type Monitor struct {
PanicRobot PanicRobot `json:"panic_robot"`
}
type PanicRobot ¶
type PanicRobot struct {
Enable bool `json:"enable"`
Wechat robotConfig `json:"wechat"`
Feishu robotConfig `json:"feishu"`
}
type Redis ¶
type Redis struct {
Name string `json:"name"` // Redis连接名
Enable bool `json:"enable"` // 开关
Host string `json:"host"` // HOST
Auth string `json:"auth"` // 授权
MaxIdle int `json:"max_idle"` // 最大空闲连接数
MaxActive int `json:"max_active"` // 一个pool所能分配的最大的连接数目
IdleTimeout time.Duration `json:"idle_timeout"` // 空闲连接超时时间,超过超时时间的空闲连接会被关闭(单位:分钟)
Prefix string `json:"prefix"` // 前缀
DB int `json:"db"`
}
type SysConfig ¶
type SysConfig struct {
Name string `json:"name"` // 应用名称
RunMode string `json:"run_mode"` // 运行模式
HTTPPort string `json:"http_port"` // 端口号
ReadTimeout time.Duration `json:"read_timeout"` // 请求最大超时时间
WriteTimeout time.Duration `json:"write_timeout"` // 响应最大超时时间
Version string `json:"version"` // 版本号
RootPath string `json:"root_path"` // 根目录
DebugMode bool `json:"debug_mode"` // 调试模式
LangDir string `json:"lang_dir"` // 语言目录
DefaultLang string `json:"default_lang"` // 默认语言
EnvKey string `json:"env_key"` // 运行环境key,用来读取运行环境
JwtSecret string `json:"jwt_secret"` // 鉴权服务JwtSecret
TokenExpire time.Duration `json:"token_expire"` // 鉴权服务token过期时间(秒)
Env string `json:"env"` // 运行环境
}
Click to show internal directories.
Click to hide internal directories.