config

package
v0.0.0-...-60b80de Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(confPath string) error

Init init config

Types

type AppConfig

type AppConfig struct {
	Name      string `json:"name"`
	RunMode   string `json:"run_mode"`
	Addr      string `json:"addr"`
	JwtSecret string `json:"jwt_secret"`
	// JWTExpirationTime day
	JwtExpirationTime int `json:"jwt_expiration_time"`
}

AppConfig ...

type CacheConfig

type CacheConfig struct {
	Driver string `json:"driver"`
	Prefix string `json:"prefix"`
}

CacheConfig ...

type Config

type Config struct {
	// common
	App           AppConfig            `json:"app"`
	MySQL         MySQLConfig          `json:"mysql"`
	Redis         RedisConfig          `json:"redis"`
	Cache         CacheConfig          `json:"cache"`
	SentinelRules []SentinelRuleConfig `json:"sentinel_rules"`
}

Config global config include common and biz config

var (
	// Conf ...
	Conf *Config
)

type MySQLConfig

type MySQLConfig struct {
	Name            string `json:"name"`
	Addr            string `json:"addr"`
	DB              string `json:"db"`
	UserName        string `json:"username"`
	Password        string `json:"password"`
	MaxIdleConn     int    `json:"max_idel_conn"`
	MaxOpenConn     int    `json:"max_open_conn"`
	ConnMaxLifeTime int    `json:"conn_max_lifetime"`
}

MySQLConfig ...

type RedisConfig

type RedisConfig struct {
	Addr         string `json:"addr"`
	Password     string `json:"password"`
	DB           int    `json:"db"`
	DialTimeout  int    `json:"dial_timeout"`
	ReadTimeout  int    `json:"read_timeout"`
	WriteTimeout int    `json:"write_timeout"`
	PoolSize     int    `json:"pool_size"`
}

RedisConfig ...

type SentinelRuleConfig

type SentinelRuleConfig struct {
	Resource        string `json:"resource"`
	MetricType      string `json:"metric_type"`
	ControlBehavior string `json:"control_behavior"`
	Count           int64  `json:"count"`
}

SentinelRuleConfig ...

Jump to

Keyboard shortcuts

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