conf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath() string

func SetConfig

func SetConfig(cfg *App)

func SetConfigPath

func SetConfigPath(path string)

Types

type App

type App struct {
	Server Server        `json:"server" yaml:"server"`
	Env    pkg.Env       `json:"env" yaml:"env"`
	Data   Data          `json:"data" yaml:"data"`
	Logger logger.Config `json:"logger" yaml:"logger"`
	MQ     pkg.MQ        `json:"rabbitmq" yaml:"rabbitmq"`
	Oss    oss.Oss       `json:"oss" yaml:"oss"`
	Jwt    jwt.Jwt       `json:"jwt" yaml:"jwt"`
	Wechat wechat.Config `json:"wechat" yaml:"wechat"`

	WithCronJob bool `json:"-"`
	WithOutMQ   bool `json:"-"`
}

func GetConfig

func GetConfig() *App

func ReadConfig

func ReadConfig(configFilePath string) *App

type Data

type Data struct {
	Db    mysql.DB    `json:"db" yaml:"db"`
	Redis redis.Redis `json:"redis" yaml:"redis"`
}

type Grpc

type Grpc struct {
	Network string        `json:"network" yaml:"network"`
	Addr    string        `json:"addr" yaml:"addr"`
	Port    string        `json:"port" yaml:"port"`
	Timeout time.Duration `json:"timeout" yaml:"timeout"`
}

type Http

type Http struct {
	Network string        `json:"network" yaml:"network"`
	Addr    string        `json:"addr" yaml:"addr"`
	Port    int           `json:"port" yaml:"port"`
	Timeout time.Duration `json:"timeout" yaml:"timeout"`
}

type Server

type Server struct {
	Http Http `json:"http" yaml:"http"`
	Grpc Grpc `json:"grpc" yaml:"grpc"`
	WS   WS   `json:"ws" yaml:"ws"`
}

type WS

type WS struct {
	Network      string        `json:"network" yaml:"network"`
	Addr         string        `json:"addr" yaml:"addr"`
	Port         int           `json:"port" yaml:"port"`
	PingTimeout  time.Duration `json:"pingTimeout" yaml:"pingTimeout"`
	PingInterval time.Duration `json:"pingInterval" yaml:"pingInterval"`
}

Jump to

Keyboard shortcuts

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