env

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModuleConfig

func NewModuleConfig(core *viper.Viper, variablesConfigs map[string]VarReader) *moduleConfig

NewModuleConfig returns an initialized *moduleConfig.

Types

type ModuleConfig

type ModuleConfig interface {
	// SubReader returns new ModuleConfig instance representing a sub tree of this instance.
	// SubReader is case-insensitive for a key.
	SubConfig(key string) ModuleConfig

	// GetString returns the value associated with the key as a string
	GetString(key string) string

	// GetBool returns the value associated with the key as a boolean.
	GetBool(key string) bool

	// GetInt64 returns the value associated with the key as an integer.
	GetInt64(key string) int64

	// GetInt returns the value associated with the key as an integer.
	GetInt(key string) int

	// GetFloat64 returns the value associated with the key as a float64.
	GetFloat64(key string) float64

	// GetTime returns the value associated with the key as time.
	GetTime(key string) time.Time

	// GetStringMapString returns the value associated with the key as a map of strings.
	GetStringMapString(key string) map[string]string

	// GetStringSlice returns the value associated with the key as a slice of strings.
	GetStringSlice(key string) []string

	// UnmarshalKey takes a single key and unmarshals it into a Struct.
	UnmarshalKey(key string, rawVal interface{}) error

	// Unmarshal unmarshals the config into a Struct. Make sure that the tags
	// on the fields of the structure are properly set.
	Unmarshal(rawVal interface{}) error

	// IsSet checks to see if the key has been set in any of the data locations.
	// IsSet is case-insensitive for a key.
	IsSet(key string) bool

	// InConfig checks to see if the given key (or an alias) is in the config file.
	InConfig(key string) bool
}

ModuleConfig is used to read config

type VarReader

type VarReader interface {
	// GetString returns the value associated with the key as a string
	GetString(key string) string

	// IsSet checks to see if the key has been set in any of the data locations.
	IsSet(key string) bool
}

Jump to

Keyboard shortcuts

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