config

package
v0.0.0-...-780cc0d Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 7 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 {
	*viper.Viper
	Name        string   `json:"name"`        // 配置文件名称
	Paths       []string `json:"paths"`       // 配置文件路径
	Environment string   `json:"environment"` // 环境变量
}

func NewConfig

func NewConfig(name string, paths ...string) *Config

NewConfig 实例化配置

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig 实例化配置

func (Config) Bind

func (c Config) Bind(cfg any) error

Bind 初始化配置到cfg对象里面

func (Config) ReadConfig

func (c Config) ReadConfig(needEnv bool) *Config

func (Config) Save

func (c Config) Save()

Save 保存配置到文件

Jump to

Keyboard shortcuts

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