global

package
v0.0.0-...-426aaea Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppConfig   = new(BaseConf)
	ProxyConfig = new(ProxyConf)
	DB          *gorm.DB
	Redis       redis.UniversalClient
	Logger      *logrus.Logger
)

Functions

func InitConfig

func InitConfig(baseConfPath, proxyConfPath string)

func InitLogger

func InitLogger(config *ServerConfig)

func InitMySQL

func InitMySQL(config *MySQLConfig)

func InitRedis

func InitRedis(config *RedisConfig)

Types

type BaseConf

type BaseConf struct {
	Server *ServerConfig `yaml:"server"`
	MySQL  *MySQLConfig  `yaml:"mysql"`
	Redis  *RedisConfig  `yaml:"redis"`
	Etcd   *EtcdConfig   `yaml:"etcd"`
}

type EtcdConfig

type EtcdConfig struct {
	Endpoints []string `yaml:"endpoints"`
}

type HttpProxyCommon

type HttpProxyCommon struct {
	Addr string `yaml:"addr"`
}

type HttpProxyInfo

type HttpProxyInfo struct {
	Port           int `yaml:"port"`
	ReadTimeout    int `yaml:"read_timeout"`
	WriteTimeout   int `yaml:"write_timeout"`
	MaxHeaderBytes int `yaml:"max_header_bytes"`
}

type MySQLConfig

type MySQLConfig struct {
	Hostname string `yaml:"hostname"`
	Port     int    `yaml:"port"`
	UserName string `yaml:"username"`
	Password string `yaml:"password"`
	DB       string `yaml:"db"`
	DSN      string
}

type ProxyConf

type ProxyConf struct {
	Common *HttpProxyCommon `yaml:"common"`
	Http   *HttpProxyInfo   `yaml:"http"`
	Https  *HttpProxyInfo   `yaml:"https"`
}

type RedisConfig

type RedisConfig struct {
	Hostname string `yaml:"hostname"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
	Addr     string
}

type ServerConfig

type ServerConfig struct {
	Port       int    `yaml:"port"`
	Mode       string `yaml:"mode"`
	LogFileDir string `yaml:"logfile_dir"`
}

Jump to

Keyboard shortcuts

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