Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Config *Config
}
func (*App) LoadFromYamlContent ¶ added in v1.0.9
LoadFromYamlContent 从给定的yaml内容加载配置
func (*App) LoadFromYamlFile ¶ added in v1.0.9
LoadFromYamlFile 从指定路径的yaml文件加载配置
type CaptchaConfig ¶
type CaptchaConfig struct { Width int `yaml:"width"` // 图片宽度 Height int `yaml:"height"` // 图片高度 Source string `yaml:"seed"` // 种子字符 Length int `yaml:"length"` // 验证码字符数 NoiseCount int `yaml:"noiseCount"` // 干扰字符数 FontName string `yaml:"fontName"` // 字体名称 BackgroundColor string `yaml:"background"` // 背景色 Store string `yaml:"store"` // 验证码保存:memory|redis }
CaptchaConfig requires github.com/hetianyi/base64Captcha
type Config ¶
type Config struct { Server Server `yaml:"server"` RedisConfig RedisConfig `yaml:"redis"` MysqlConfig MysqlConfig `yaml:"mysql"` CaptchaConfig CaptchaConfig `yaml:"captcha"` }
Config 为全部配置 requires gopkg.in/yaml.v2
type MysqlConfig ¶
type MysqlConfig struct { // mysql连接,格式: // // <username>:<password>@tcp(<host>:<port>)/<db>?charset=utf8&parseTime=True&loc=Local Conn string `yaml:"conn"` // 最大空闲连接 MaxIdleConns int `yaml:"maxIdleConns"` // 最大连接数 MaxOpenConns int `yaml:"maxOpenConns"` // 每个连接最长声明周期 ConnMaxLifetime int `yaml:"connMaxLifetime"` }
MysqlConfig 为mysql的配置
requires gorm.io/driver/mysql and gorm.io/gorm
type RedisConfig ¶
type RedisConfig struct { Host string `yaml:"host"` // 服务器地址 Port int `yaml:"port"` // 服务端口 Pass string `yaml:"pass"` // 密码 DefaultDB int `yaml:"db"` // 默认数据库 }
RedisConfig 为redis的配置
requires github.com/go-redis/redis
type Server ¶
type Server struct { Host string `yaml:"host"` // HTTP服务监听地址 Port int `yaml:"port"` // HTTP服务监听端口 GinMode string `yaml:"mode"` // 服务启动模式:debug|release UseGinLogger bool `yaml:"useGinLogger"` // 是否开启gin的默认Logger MiddleWares []string `yaml:"middleWares"` // 中间件名称列表 Validators []string `yaml:"validators"` // 校验器名称列表 ApiGroup []ApiGroup `yaml:"groups"` // 路由配置 }
Server 为http服务器的配置
Click to show internal directories.
Click to hide internal directories.