config

package
v0.0.0-...-4c856c0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SanitizedValue = "*****"

Variables

This section is empty.

Functions

func DumpToFile

func DumpToFile(filename string, cfg Config) error

func FromYAML

func FromYAML(content []byte, cfg Config) error

func Load

func Load(file string, cfg Config) error

func LoadWithOption

func LoadWithOption(file string, cfg Config, strict bool, includeEnv bool, validate bool) error

func PrintDeprecations

func PrintDeprecations(deprecations []Deprecation, cfg Config, out io.Writer)

func ToJson

func ToJson(cfg Config) ([]byte, error)

ToJson converts through YAML, because we only have `yaml` tags on Config. This JSON cannot be parsed by json.Unmarshal because durations are marshaled by yaml to pretty form like "1s". To change it to simple json.Marshal we need to add `json` tag everywhere.

func ToYAML

func ToYAML(cfg Config) ([]byte, error)

Types

type BaseConfig

type BaseConfig struct{}

func (BaseConfig) PostProcess

func (c BaseConfig) PostProcess() error

func (BaseConfig) Sanitize

func (c BaseConfig) Sanitize()

func (BaseConfig) Validate

func (c BaseConfig) Validate() error

type Config

type Config interface {
	Sanitize()
	Validate() error
	PostProcess() error
}

func ConfigForDisplay

func ConfigForDisplay(cfg Config) (Config, error)

type Deprecation

type Deprecation struct {
	Env             string
	EnvMsg          string
	ConfigValuePath func(cfg Config) (string, bool)
	ConfigValueMsg  string
}

Jump to

Keyboard shortcuts

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