Documentation
¶
Index ¶
- Variables
- func AddPostProcessor(priority int, name string, processor PostProcessor)
- func ApplyPostProcessors(config GosoConf) (map[string]int, error)
- func DebugConfig(config Config, logger Logger) error
- func Merge(target interface{}, source interface{}) error
- func NewMemoryEnvProvider(initialValues ...map[string]string) *memoryEnvProvider
- func NewOsEnvProvider() *osEnvProvider
- func PanicErrorHandler(msg string, args ...interface{})
- func Sanitize(key string, value interface{}, sanitizers []Sanitizer) (interface{}, error)
- func SkipExisting() func(mode *mapx.OpMode)
- func StringToTimeHookFunc(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)
- func TimeSanitizer(in interface{}) (interface{}, error)
- func WithDefaultErrorHandler(handler ErrorHandler)
- type AppId
- type Config
- type EnvProvider
- type ErrorHandler
- type GosoConf
- type Logger
- type LookupEnv
- type MergeOption
- type Option
- func WithConfigBytes(bytes []byte, format string) Option
- func WithConfigFile(filePath string, fileType string) Option
- func WithConfigFileFlag(flagName string) Option
- func WithConfigMap(settings map[string]any, mergeOptions ...MergeOption) Option
- func WithConfigSetting(key string, settings any, mergeOptions ...MergeOption) Option
- func WithEnvKeyPrefix(prefix string) Option
- func WithEnvKeyReplacer(replacer *strings.Replacer) Option
- func WithErrorHandlers(handlers ...ErrorHandler) Option
- func WithSanitizers(sanitizer ...Sanitizer) Option
- type PostProcessor
- type Sanitizer
- type Sentry
- type UnmarshalDefaults
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultEnvKeyReplacer = strings.NewReplacer(".", "_", "-", "_")
)
Functions ¶
func AddPostProcessor ¶
func AddPostProcessor(priority int, name string, processor PostProcessor)
func DebugConfig ¶
func NewMemoryEnvProvider ¶
func NewOsEnvProvider ¶
func NewOsEnvProvider() *osEnvProvider
func PanicErrorHandler ¶
func PanicErrorHandler(msg string, args ...interface{})
func SkipExisting ¶
func StringToTimeHookFunc ¶
func TimeSanitizer ¶
func TimeSanitizer(in interface{}) (interface{}, error)
func WithDefaultErrorHandler ¶
func WithDefaultErrorHandler(handler ErrorHandler)
Types ¶
type AppId ¶
type AppId struct {
Project string `cfg:"project" default:"{app_project}" json:"project"`
Environment string `cfg:"environment" default:"{env}" json:"environment"`
Family string `cfg:"family" default:"{app_family}" json:"family"`
Group string `cfg:"group" default:"{app_group}" json:"group"`
Application string `cfg:"application" default:"{app_name}" json:"application"`
}
func GetAppIdFromConfig ¶
func (*AppId) PadFromConfig ¶
type Config ¶
type Config interface {
AllKeys() []string
AllSettings() map[string]interface{}
Get(key string, optionalDefault ...interface{}) interface{}
GetBool(key string, optionalDefault ...bool) bool
GetDuration(key string, optionalDefault ...time.Duration) time.Duration
GetInt(key string, optionalDefault ...int) int
GetIntSlice(key string, optionalDefault ...[]int) []int
GetFloat64(key string, optionalDefault ...float64) float64
GetMsiSlice(key string, optionalDefault ...[]map[string]interface{}) []map[string]interface{}
GetString(key string, optionalDefault ...string) string
GetStringMap(key string, optionalDefault ...map[string]interface{}) map[string]interface{}
GetStringMapString(key string, optionalDefault ...map[string]string) map[string]string
GetStringSlice(key string, optionalDefault ...[]string) []string
GetTime(key string, optionalDefault ...time.Time) time.Time
IsSet(string) bool
HasPrefix(prefix string) bool
UnmarshalDefaults(val interface{}, additionalDefaults ...UnmarshalDefaults)
UnmarshalKey(key string, val interface{}, additionalDefaults ...UnmarshalDefaults)
}
type EnvProvider ¶
type ErrorHandler ¶
type ErrorHandler func(msg string, args ...interface{})
func LoggerErrorHandler ¶
func LoggerErrorHandler(logger Logger) ErrorHandler
func SentryErrorHandler ¶
func SentryErrorHandler(sentry Sentry) ErrorHandler
type GosoConf ¶
func NewWithInterfaces ¶
func NewWithInterfaces(envProvider EnvProvider, msis ...map[string]interface{}) GosoConf
type MergeOption ¶
type Option ¶
type Option func(cfg *config) error
func WithConfigBytes ¶ added in v0.36.1
func WithConfigFile ¶
func WithConfigFileFlag ¶
func WithConfigMap ¶
func WithConfigMap(settings map[string]any, mergeOptions ...MergeOption) Option
func WithConfigSetting ¶
func WithConfigSetting(key string, settings any, mergeOptions ...MergeOption) Option
func WithEnvKeyPrefix ¶
func WithEnvKeyReplacer ¶
func WithErrorHandlers ¶
func WithErrorHandlers(handlers ...ErrorHandler) Option
func WithSanitizers ¶
type PostProcessor ¶
type UnmarshalDefaults ¶
func UnmarshalWithDefaultForKey ¶
func UnmarshalWithDefaultForKey(targetKey string, setting interface{}) UnmarshalDefaults
func UnmarshalWithDefaultsFromKey ¶
func UnmarshalWithDefaultsFromKey(sourceKey string, targetKey string) UnmarshalDefaults
Source Files
¶
Click to show internal directories.
Click to hide internal directories.