conf

package
v0.0.0-...-78a0d84 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfPath

func GetConfPath(path ...string) string

func GetServerId

func GetServerId() string

func GetServerName

func GetServerName() string

func InitCfg

func InitCfg(path ...string)

func LoadFile

func LoadFile(path string) ([]byte, error)

Types

type DBConfig

type DBConfig struct {
	Type string `json:"type"`
	Name string `json:"name"`
	Host string `json:"host"`
	Port int    `json:"port"`
	User string `json:"user"`
	Pwd  string `json:"pwd"`
}

func GetDBCfg

func GetDBCfg(srvName string) *DBConfig

type GlobalVal

type GlobalVal struct {
	MaxConnNum       int
	MaxPacketSize    int32
	MaxQueueSize     int32
	HttpTimeout      time.Duration
	PongWait         time.Duration
	WriteWait        time.Duration
	RedisIdleTimeout time.Duration
}

func GetGlobalVal

func GetGlobalVal() *GlobalVal

type LogConfig

type LogConfig struct {
	LogLevel     string `json:"logLevel"`
	LogPath      string `json:"logPath"`
	LogFile      string `json:"logFile"`
	MaxAge       int    `json:"maxAge"`       //minute, -1 unlimited
	RotationTime int    `json:"rotationTime"` //minute
}

func GetDefaultLogConf

func GetDefaultLogConf() *LogConfig

func GetLogCfg

func GetLogCfg(logName string) *LogConfig

type ServerCfgMgr

type ServerCfgMgr struct {
	ServerId   string                   `json:"server_id"`
	ServerName string                   `json:"server_name"`
	Servers    map[string]*ServerConfig `json:"servers"`
	Db         map[string]*DBConfig     `json:"db"`
	Log        map[string]*LogConfig    `json:"log"`
	// contains filtered or unexported fields
}

func GetDefalutServerCfgMgr

func GetDefalutServerCfgMgr() *ServerCfgMgr

func NewServerCfgMgr

func NewServerCfgMgr() *ServerCfgMgr

func (*ServerCfgMgr) GetDBCfg

func (scm *ServerCfgMgr) GetDBCfg(key string) *DBConfig

func (*ServerCfgMgr) GetLogCfg

func (scm *ServerCfgMgr) GetLogCfg(logName string) *LogConfig

func (*ServerCfgMgr) GetServerId

func (scm *ServerCfgMgr) GetServerId() string

func (*ServerCfgMgr) GetServerName

func (scm *ServerCfgMgr) GetServerName() string

func (*ServerCfgMgr) GetSrvCfg

func (scm *ServerCfgMgr) GetSrvCfg(key string) *ServerConfig

func (*ServerCfgMgr) LoadConf

func (scm *ServerCfgMgr) LoadConf(path ...string)

type ServerConfig

type ServerConfig struct {
	Name          string   `json:"name"`
	Host          string   `json:"host"`
	Port          int      `json:"port"`
	WebHost       string   `json:"webHost"`
	WebPort       int      `json:"webPort"`
	MaxConn       int      `json:"maxConn"`
	MaxPacketSize int      `json:"maxPacketSize"`
	Remotes       []string `json:"remotes"`
	HostList      []string `json:"hostList"`
	Timeout       int64    `json:"timeout"`
	Group         string   `json:"group"`
	WatchGroups   []string `json:"watchGroups"`
}

func GetSrvCfg

func GetSrvCfg(srvName string) *ServerConfig

Jump to

Keyboard shortcuts

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