config

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	System    *SystemConfig    `mapstructure:"system" json:"system"`
	Logs      *LogsConfig      `mapstructure:"logs" json:"logs"`
	SqlServer *SqlServerConfig `mapstructure:"sql-server" json:"sqlserver"`
	Jwt       *JwtConfig       `mapstructure:"jwt" json:"jwt"`
}

func InitConfig

func InitConfig(configFileName string) *Config

type JwtConfig

type JwtConfig struct {
	Realm      string `mapstructure:"realm" json:"realm"`            // jwt标识
	Key        string `mapstructure:"key" json:"key"`                // 服务端密钥
	Timeout    int    `mapstructure:"timeout" json:"timeout"`        // token过期时间, 小时
	MaxRefresh int    `mapstructure:"max-refresh" json:"maxRefresh"` // 刷新token最大过期时间, 小时
}

type LogsConfig

type LogsConfig struct {
	Level      zapcore.Level `mapstructure:"level" json:"level"`            // 日志等级
	Path       string        `mapstructure:"path" json:"path"`              // 日志路径
	MaxSize    int           `mapstructure:"max-size" json:"maxSize"`       // 文件最大大小, M
	MaxBackups int           `mapstructure:"max-backups" json:"maxBackups"` // 备份数
	MaxAge     int           `mapstructure:"max-age" json:"maxAge"`         // 存放时间, 天
	Compress   bool          `mapstructure:"compress" json:"compress"`      // 是否压缩
}

type SqlServerConfig

type SqlServerConfig struct {
	Username    string `mapstructure:"username" json:"username"`        // 用户名称
	Password    string `mapstructure:"password" json:"password"`        // 密码
	Database    string `mapstructure:"database" json:"database"`        // 数据库
	Host        string `mapstructure:"host" json:"host"`                // 服务器地址
	Port        int    `mapstructure:"port" json:"port"`                // 端口号
	LogMode     bool   `mapstructure:"log-mode" json:"logMode"`         // 开启日志
	TablePrefix string `mapstructure:"table-prefix" json:"tablePrefix"` // 表前缀  暂未使用
}

type SystemConfig

type SystemConfig struct {
	Mode string `mapstructure:"mode" json:"mode"` // 服务运行模式
	Port int    `mapstructure:"port" json:"port"` // 端口号
	Name string `mapstructure:"name" json:"name"` // 服务名称
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL