config

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoKey          = utils.Error("Config key does not exist")
	ErrNotImplemented = utils.Error("Config method or type not implemented")
	ErrInvalidType    = utils.Error("Invalid destination type")
	ErrInvalidDefault = utils.Error("Invalid default value")
)

Variables

This section is empty.

Functions

func StrOrFile

func StrOrFile(value string) string

StrOrFile attempts to identify a valid file path from value; if value starts with "/" or "./" it will attempt to read the file contents and return it instead; if the file contains an extra \n it will be trimmed. If no file is found (either value does not start with "/" or "./", or file does not exist), value is returned.

func StrOrFileIfExists added in v0.8.7

func StrOrFileIfExists(value string) string

StrOrFileIfExists reads and returns the contents of value if it points to an existing regular file. If value is not an existing file, the original string is returned unchanged.

Types

type ConfigProvider added in v0.6.0

type ConfigProvider interface {
	Get(dest interface{}) error
	GetKey(key string, dest interface{}) error
	GetStringKey(key string) (string, error)
	GetBoolKey(key string) (bool, error)
	GetIntKey(key string) (int, error)
	GetFloat64Key(key string) (float64, error)
	GetSliceKey(key, separator string) ([]string, error)
	GetConfigNode(key string) (ConfigProvider, error)
	KeyExists(key string) bool
	KeyListExists(keys []string) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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