yamlcfg

package
v0.0.96 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalYAML

func MarshalYAML(c *config.Configuration) ([]byte, error)

MarshalYAML returns a YAML file representing the parsed configuration. Returns an error if config is invalid or encoding failed.

func ReadConfig

func ReadConfig(paths []string, defaultpath string, strict bool) (config.Configuration, error)

ReadConfig takes multiple source paths of the following form:

  If path is a local file, then the file will be parsed as YAML
  If path is a directory, then all files and directories within it will be parsed.
    If this directory has a default(s).yaml file, apply it to all configured entities,
		 after applying defaults from defaultPath.

Optionally, defaultPath points to default setting YAML Returns a configuration proto containing the data from all of those sources

func ReconcileDashboardTab

func ReconcileDashboardTab(currentTab *config.DashboardTab, defaultTab *config.DashboardTab)

ReconcileDashboardTab sets unfilled currentTab fields to the corresponding defaultTab value, if present

func ReconcileTestGroup

func ReconcileTestGroup(currentTestGroup *config.TestGroup, defaultTestGroup *config.TestGroup)

ReconcileTestGroup sets unfilled currentTestGroup fields to the corresponding defaultTestGroup value, if present

func SeekYAMLFiles

func SeekYAMLFiles(paths []string, callFunc func(path string, info os.FileInfo) error) error

SeekYAMLFiles walks through paths and directories, calling the passed function on each YAML file future modifications to what Configurator sees as a "config file" can be made here

func Update

func Update(cfg *config.Configuration, yamlData []byte, reconcile *DefaultConfiguration, strict bool) error

Update reads the config in yamlData and updates the config in c. If reconcile is non-nil, it will pad out new entries with those default settings

Types

type DefaultConfiguration

type DefaultConfiguration struct {
	// A default testgroup with default initialization data
	DefaultTestGroup *config.TestGroup `json:"default_test_group,omitempty"`
	// A default dashboard tab with default initialization data
	DefaultDashboardTab *config.DashboardTab `json:"default_dashboard_tab,omitempty"`
}

DefaultConfiguration describes a default configuration that should be applied before other configs.

func LoadDefaults

func LoadDefaults(yamlData []byte) (DefaultConfiguration, error)

LoadDefaults reads and validates default settings from YAML Returns an error if the defaultConfig is partially or completely missing.

type MissingFieldError

type MissingFieldError struct {
	Field string
}

MissingFieldError is an error that includes the missing field.

func (MissingFieldError) Error

func (e MissingFieldError) Error() string

Jump to

Keyboard shortcuts

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