config

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfig

func SetConfig(cfg *Config)

SetConfig set config

Types

type Config

type Config struct {
	Deploy *DeployConf `toml:"deploy"`
	Mysql  *MysqlConf  `toml:"mysql"`
	Redis  *RedisConf  `toml:"redis"`
	Mc     *McConf     `toml:"mc"`
	Kafka  *KafkaConf  `toml:"kafka"`
}

Config struct define

func GetConfig

func GetConfig(filePath string) (*Config, error)

GetConfig get Config

type DeployConf

type DeployConf struct {
	APIAddr string `toml:"api_addr"` //api HTTP server listen address
}

DeployConf deploy config

func GetDeployConf

func GetDeployConf() *DeployConf

GetDeployConf get DeployConf

type KafkaConf

type KafkaConf struct {
	ZK      []string `toml:"zk"`
	Brokers []string `toml:"brokers"`
}

KafkaConf kafka config

func GetKafkaConf

func GetKafkaConf() *KafkaConf

GetKafkaConf get KafkaConf

type McConf added in v1.0.2

type McConf struct {
	Servers              string `toml:"servers"`
	MaxActiveConnections int    `toml:"max_active_connections"`
	MaxIdleConnections   int    `toml:"max_idle_connections"`
	MaxWaitTimeMs        int    `toml:"max_wait_time_ms"`
	MaxIdleTimeMs        int    `toml:"max_idle_time_ms"`
	ConnectionTimeoutMs  int    `toml:"connection_timeout_ms"`
	ReadTimeoutMs        int    `toml:"read_timeout_ms"`
	WriteTimeoutMs       int    `toml:"write_timeout_ms"`
	Rehash               bool   `toml:"rehash"`
}

McConf memcached conifg

func GetMcConf added in v1.0.2

func GetMcConf() *McConf

GetMcConf get McConf

type MysqlConf

type MysqlConf struct {
	Master           string   `toml:"master"`
	Slaves           []string `toml:"slaves"`
	Port             int      `toml:"port"`
	Username         string   `toml:"username"`
	Password         string   `toml:"password"`
	Dbname           string   `toml:"dbname"`
	MaxOpenConnCount int      `toml:"max_open_conn_count"`
	MaxIdleConnCount int      `toml:"max_idle_conn_count"`
	ConnWaitTimeMs   int      `toml:"conn_wait_time_ms"`
	ConnIdleTimeMs   int      `toml:"conn_idle_time_ms"`
	ConnTimeoutMs    int      `toml:"conn_timeout_ms"`
	WriteTimeoutMs   int      `toml:"write_timeout_ms"`
	ReadTimeoutMs    int      `toml:"read_timeout_ms"`
}

MysqlConf mysql config

func GetMysqlConf

func GetMysqlConf() *MysqlConf

GetMysqlConf get MysqlConf

type RedisConf

type RedisConf struct {
	Master           string   `toml:"master"`
	Slaves           []string `toml:"slaves"`
	MaxConns         int      `toml:"max_conns"`
	MaxIdle          int      `toml:"max_idle"`
	ReadTimeoutMs    int      `toml:"read_timeout_ms"`
	WriteTimeoutMs   int      `toml:"write_timeout_ms"`
	ConnectTimeoutMs int      `toml:"connect_timeout_ms"`
	IdleTimeoutMs    int      `toml:"idle_timeout_ms"`
	DB               int      `toml:"DB"`
	Password         string   `toml:"Password"`
}

RedisConf redis config

func GetRedisConf

func GetRedisConf() *RedisConf

GetRedisConf get RedisConf

Jump to

Keyboard shortcuts

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