gconfig

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Global *globalConfig

Functions

func LoadJsonConfig

func LoadJsonConfig(configFile string, data interface{}) error

LoadJsonConfig 读取配置文件

func LoadJsonConfigFromBasePath

func LoadJsonConfigFromBasePath(configFile string, data interface{}) error

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配置
}

func NewConfig

func NewConfig() Config

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 RedisConfig

type RedisConfig struct {
	Host   string
	Port   int
	Prefix string
}

RedisConfig 数据库配置

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服务器配置

Jump to

Keyboard shortcuts

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