configx

package
v0.0.0-...-c075a02 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Vip        = viper.New()
	ConfigFile = ""
	// ServerSetting global config
	ServerSetting = new(YamlSetting)
)

Functions

func InitConfig

func InitConfig()

InitConfig reads in config file and ENV variables if set.

Types

type Log

type Log struct {
	AppName       string `yaml:"appName"`
	Development   bool   `yaml:"development"`
	Level         string `yaml:"level"`
	LogFileDir    string `yaml:"logFileDir"`
	InfoFileName  string `yaml:"infoFileName"`
	WarnFileName  string `yaml:"warnFileName"`
	ErrorFileName string `yaml:"errorFileName"`
	DebugFileName string `yaml:"debugFileName"`
	MaxAge        int    `yaml:"maxAge"`
	MaxBackups    int    `yaml:"maxBackups"`
	MaxSize       int    `yaml:"maxSize"`
}

Log log parameters

type System

type System struct {
	Port        string `yaml:"port"`
	StoragePath string `yaml:"storagePath"`
}

type YamlSetting

type YamlSetting struct {
	System System `yaml:"system"`
	Log    Log    `yaml:"log"`
}

YamlSetting global constants are defined and configured by the user according to the file conf.yaml in conf

func GetConfig

func GetConfig(vip *viper.Viper) *YamlSetting

GetConfig 解析配置文件,反序列化

Jump to

Keyboard shortcuts

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