config

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeclareFlag

func DeclareFlag(v *viper.Viper, c *cobra.Command, name string, shorthand string, defaultVal any, usage string)

func Get

func Get[T any](v *viper.Viper) (T, error)

func GetAll

func GetAll(v *viper.Viper) map[string]interface{}

func IsDebug

func IsDebug() bool

func NewViper added in v0.0.6

func NewViper(p Options) *viper.Viper

Types

type Options added in v0.0.6

type Options struct {
	EnvNestSeparator string            // 默认为 _,即 DB_HOST=v 这样的 env 会被识别为 {db: {host: v}}
	AutoBindEnv      func(string) bool // 自动加载 env 到 allSetting 中
}

Jump to

Keyboard shortcuts

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