config

package
v0.0.0-...-5b0cbe9 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug   bool        `toml:"debug"`
	LogPath string      `toml:"log_path"`
	HTTP    *HTTPConfig `toml:"http"`
	GRPC    *GRPCConfig `toml:"grpc"`
}

Config 配置文件对应对象

var (
	// CFG 全局配置对象
	CFG *Config
)

func LoadConfig

func LoadConfig(cfgPath string) (*Config, error)

LoadConfig 读取配置

type GRPCConfig

type GRPCConfig struct {
	Enable  bool   `toml:"enable"`
	Address string `toml:"address"`
	Port    int    `toml:"port"`
}

GRPCConfig grpc监听配置

type HTTPConfig

type HTTPConfig struct {
	Enable       bool   `toml:"enable"`
	Address      string `toml:"address"`
	Port         int    `toml:"port"`
	ReadTimeout  int    `toml:"read_timeout"`
	WriteTimeout int    `toml:"write_timeout"`
}

HTTPConfig http 监听配置

Jump to

Keyboard shortcuts

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