mir_config

package
v0.0.0-...-ccaa6ab Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Yaml configFormat = "yaml"
	Json configFormat = "json"
)

Variables

This section is empty.

Functions

func WithEnvVars

func WithEnvVars() func(*MirConfig)

func WithEtcFilePath

func WithEtcFilePath(fileName string, cff configFormat, devOnly bool) func(*MirConfig)

func WithFilePath

func WithFilePath(path string, cff configFormat, devOnly bool) func(*MirConfig)

func WithFlagRegisterFilePath

func WithFlagRegisterFilePath(flag string, path string, cff configFormat, devOnly bool) func(*MirConfig)

func WithXdgConfigHomeFilePath

func WithXdgConfigHomeFilePath(fileName string, cff configFormat, devOnly bool) func(*MirConfig)

Types

type MirConfig

type MirConfig struct {
	// contains filtered or unexported fields
}

func Empty

func Empty() *MirConfig

func New

func New(appName string, options ...func(*MirConfig)) *MirConfig

The order of configuration loading is:

  • flags
  • env vars
  • config files

func (*MirConfig) All

func (s *MirConfig) All() map[string]any

func (*MirConfig) Get

func (s *MirConfig) Get(path string) any

func (*MirConfig) Load

func (s *MirConfig) Load() (errs error, warns error)

func (*MirConfig) LoadAndUnmarshal

func (s *MirConfig) LoadAndUnmarshal(out any) (errs error, warns error)

func (*MirConfig) Set

func (s *MirConfig) Set(key string, val any) error

func (*MirConfig) Unmarshal

func (s *MirConfig) Unmarshal(out any) error

Jump to

Keyboard shortcuts

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