configuration

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConfig = errors.New("invalid configuration")
)

Functions

func Apply

func Apply(gs *goschtalt.Config, name string, required bool, opts ...goschtalt.ExpandOption) error

Apply applies the external configurations defined to the goschtalt configuration system.

Types

type External

type External struct {
	// Required determines if the external configuration file is required.  If
	// the file is required and cannot be found, the program will exit with an
	// error.
	Required bool

	// File is the path to the external configuration file based on the root path.
	File string

	// As is the alternate file extension to use when decoding the file.  If empty,
	// the file extension is used (like normal).
	As string

	// Origin is the origin of the external configuration file.  This is used in
	// by the configuration system to express where the configuration came from.
	Origin string

	// Remap is an array of from/to mappings that are used to remap the keys in the
	// external configuration file to the keys in the internal configuration map.
	Remap []Remap
	// contains filtered or unexported fields
}

External represents an external configuration file that is used to populate a map of string values.

type Remap

type Remap struct {
	// From is the key in the external configuration file.
	From string

	// To is the key in the internal configuration map.
	To string

	// Optional determines if the key is optional.  If the key is optional and cannot
	// be found in the external configuration file, the key is not added to the internal
	// configuration map.  If the key is not optional and cannot be found, the program
	// will exit with an error.
	Optional bool
}

Remap represents a key remapping from the external configuration file to the internal configuration map.

Jump to

Keyboard shortcuts

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