conf

package
v3.0.17 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Splitter = regexp.MustCompile(`,`)

Splitter is the regex used to split YAML_FILES and YAML_VARS

Functions

func DecodeBase64Strings

func DecodeBase64Strings(values ...string) ([]string, error)

DecodeBase64Strings will decode all the base64 strings supplied

func ReadEnvVars

func ReadEnvVars(names ...string) ([]string, error)

ReadEnvVars will read all the environment variables named and return an array of their values. The order of the names to values will be preserved.

func ReadFiles

func ReadFiles(files ...string) ([]string, error)

ReadFiles will read all the files supplied and return an array of their contents. The order of files to contents will be preserved.

Types

type ConfSources

type ConfSources struct {
	// Environment loads config from environment vars when true. The vars loaded
	// are:
	// YAML_FILES: comma separated values will be appended to Files
	// YAML_VARS: comma separated values of other environment variables to read
	// and whose base64 strings will be appended to Overrides
	Environment bool
	// Files is a list of filenames to read
	Files []string
	// Overrides are Base64 encoded strings of yaml
	Overrides []string
	// Patches are files containing JSON 6902 patches to apply after the merge
	// is complete
	Patches []string
	// PatchStrings are strings containing JSON 6902 patches to apply after the
	// merge is complete
	PatchStrings []string
	// An optional (can be nil) stream to read raw yaml (potentially multiple
	// inline documents)
	Stream io.Reader
}

ConfSources contains sources of yaml for loading. See Load() for precedence

func (ConfSources) LoadInterface

func (s ConfSources) LoadInterface() (interface{}, error)

LoadInterface will load the config determined by settings in the struct. In order of precedence (highest last), Files, YAML_FILES env var, Overrides, YAML_VARS env var, Stream.

func (ConfSources) LoadSettableInterface

func (s ConfSources) LoadSettableInterface() (interface{}, string, error)

LoadSettableInterface will load the config determined by settings in the struct. Will fail if more than one file source or any non-file source is indicated. Returns the conf, and the file that values can be set in.

Jump to

Keyboard shortcuts

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