config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBrokerConfig

func InitBrokerConfig()

func InitLogicConfig

func InitLogicConfig()

func ReadConfig

func ReadConfig(role string, cfgFile string)

Types

type BrokerConfig

type BrokerConfig struct {
	Logger LogConfig `mapstructure:"logger"`

	LogicDealer struct {
		Address string `mapstructure:"address"`
	} `mapstructure:"logic_dealer"`

	Broker struct {
		WebSocketAddress string `mapstructure:"ws_address"`
		GrpcAddress      string `mapstructure:"grpc_address"`
	} `mapstructure:"broker"`

	Ping struct {
		Interval time.Duration `mapstructure:"interval"`
		MaxWait  time.Duration `mapstructure:"maxWait"`
	} `mapstructure:"ping"`

	BrokerGrpcAddr string
}

func GetBrokerOpts

func GetBrokerOpts() *BrokerConfig

type LogConfig

type LogConfig struct {
	Level    string `mapstructure:"level"`
	FilePath string `mapstructure:"filepath"`
}

type LogicConfig

type LogicConfig struct {
	Logger LogConfig `mapstructure:"logger"`

	LogicDealer struct {
		ListenAddress string `mapstructure:"listen_address"`
	} `mapstructure:"logic_dealer"`

	MySQLConf MySQLConf `mapstructure:"mysql"`
}

func GetLogicOpts

func GetLogicOpts() *LogicConfig

type MySQLConf

type MySQLConf struct {
	DSN             string `mapstructure:"dsn"`
	MaxIdleConn     int    `mapstructure:"max_idle_conn"`
	MaxOpenConn     int    `mapstructure:"max_open_conn"`
	ConnMaxLifeSecs int    `mapstructure:"conn_max_life_secs"`
	// 是否启动debug模式
	// 若开启则会打印具体的执行SQL
	Debug bool `mapstructure:"debug"`
}

Jump to

Keyboard shortcuts

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