config

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStdViperConfig

func NewStdViperConfig(opts ...Option) *stdViperConfig

Types

type Config

type Config interface {
	Load() error
	Get(key string) Value
	IsSet(key string) bool
	Unmarshal(obj any) error
	UnmarshalKey(key string, obj any) error
	GetConfigPath(env string) (string, error)
}

type Option

type Option func(*stdViperConfig)

func AutomaticEnv

func AutomaticEnv(enabled bool) Option

func ConfigFileDir

func ConfigFileDir(dir string) Option

func ConfigFileName

func ConfigFileName(name string) Option

func ConfigFileSuffix

func ConfigFileSuffix(suffix string) Option

func EnvPrefix

func EnvPrefix(prefix string) Option

func ValidEnvs

func ValidEnvs(envs []string) Option

func ViperOption

func ViperOption(opts ...viper.Option) Option

type Value

type Value interface {
	Raw() any
	String() string
	Bool() bool
	Int() int
	Int8() int8
	Int16() int16
	Int32() int32
	Int64() int64
	Uint() uint
	Uint8() uint8
	Uint16() uint16
	Uint32() uint32
	Uint64() uint64
	Float32() float32
	Float64() float64
	Time() time.Time
	Duration() time.Duration
	Slice() []any
	IntSlice() []int
	StringSlice() []string
	Float64Slice() []float64
	Map() map[string]any
}

Jump to

Keyboard shortcuts

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