Documentation
¶
Index ¶
- Variables
- func LoadJsonConfig(configFile string, data interface{}) error
- func LoadJsonConfigFromBasePath(configFile string, data interface{}) error
- type ClientConfig
- type Config
- type ConsoleConfig
- type DBConfig
- type HttpServerConfig
- type LogConfig
- type NsqConfig
- type PprofConfig
- type RedisConfig
- type RpcServerConfig
- type TcpServerConfig
- type WsServerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var Global *globalConfig
Functions ¶
func LoadJsonConfig ¶
LoadJsonConfig 读取配置文件
func LoadJsonConfigFromBasePath ¶
LoadJsonConfigFromBasePath 读取配置文件
Types ¶
type ClientConfig ¶
type ClientConfig struct {
RemoteHost string // 远程服务器主机ip
RemoteTcpPort int32 // 远程服务器主机端口号
ClientName string
ClientId string
}
ClientConfig 客户端配置
type Config ¶
type Config struct {
Debug bool // 是否开启Debug模式
ServerCode string // 服务器编号
BasePath string // 程序根目录
ServerName string // 当前服务器名称
ServerId string // 服务器id
Version string // 服务器版本
Master ClientConfig // 中心服务器链接地址配置
DataBase map[string]*DBConfig // 数据库配置
CHDataBase map[string]*DBConfig // ClickHouse数据库配置
Redis map[string]*RedisConfig // Redis配置
Log map[string]*LogConfig // 日志配置
TcpServer TcpServerConfig // TCP服务器配置
WsServer WsServerConfig // WebSocket服务器配置
HttpServer HttpServerConfig // HTTP服务器配置
RpcServer RpcServerConfig // RPC服务器配置
Console ConsoleConfig // 控制台配置
Pprof PprofConfig // Pprof控制
Nsq NsqConfig // NSQ配置
}
type ConsoleConfig ¶
type ConsoleConfig struct {
ConsolePrompt string // 控制台进入提示
// contains filtered or unexported fields
}
type DBConfig ¶
type DBConfig struct {
Host string
Port int
User string
Password string
DbName string
Prefix string
MaxIdleConn int // 最大空闲连接数
MaxOpenConn int // 最大打开连接数
ShowLog bool // 是否现实日志
}
DBConfig 数据库配置
type HttpServerConfig ¶
type HttpServerConfig struct {
CertFile string // SSL证书地址
KeyFile string // SSL证书密钥地址
// contains filtered or unexported fields
}
HttpServerConfig Http服务器配置
type LogConfig ¶
type LogConfig struct {
Level string // 输出日志等级
StackLevel string // 堆栈输出日志等级
EnableWriteFile bool // 是否输出文件(必需配置FilePath)
EnableConsole bool // 是否控制台输出
FilePath string // 日志文件输出路径
FileFormat string // 日志文件格式
MaxAge int // 最大保留天数 maxAge达到限制,则会被清理
RotationTime int // 日志自动切割时长,单位小时
TimeFormat string // 时间输出格式
PrintCaller bool // 是否打印调用函数
}
LogConfig 日志配置
type NsqConfig ¶
type NsqConfig struct {
// contains filtered or unexported fields
}
NsqConfig Nsq配置
type PprofConfig ¶
type PprofConfig struct {
// contains filtered or unexported fields
}
PprofConfig Pprof服务器配置
type RpcServerConfig ¶
type RpcServerConfig struct {
// contains filtered or unexported fields
}
RpcServerConfig RPC服务器配置
type TcpServerConfig ¶
type TcpServerConfig struct {
MaxConn int32 // 当前服务器允许的最大链接数
WorkerPoolSize uint32 // 业务工作Worker池的数量
WorkerTaskLen uint32 // 业务工作Worker对应负责的任务队列最大任务存储数量
MaxMsgChanLen uint32 // MsgBuffChan长度
// contains filtered or unexported fields
}
TcpServerConfig Tcp服务器配置
type WsServerConfig ¶
type WsServerConfig struct {
MaxConn int32 // 当前服务器允许的最大链接数
WorkerPoolSize uint32 // 业务工作Worker池的数量
WorkerTaskLen uint32 // 业务工作Worker对应负责的任务队列最大任务存储数量
MaxMsgChanLen uint32 // MsgBuffChan长度
CertFile string // SSL证书地址
KeyFile string // SSL证书密钥地址
// contains filtered or unexported fields
}
WsServerConfig Websocket服务器配置
Click to show internal directories.
Click to hide internal directories.