configuration

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package configuration defines data structure (configuration) for the data-driven renderer

Configuration is a tree structure and can be created from a YAML files or 'key=value' pairs.

Index

Constants

View Source
const (
	// RootKey is an special configuration key key used by e.g. the Base and Root functions
	RootKey = "root"
)

Variables

View Source
var (
	// VarArgRegexp defines the extra variable parameter format
	VarArgRegexp = matcher.NewMust(`^(?P<name>\S+)=(?P<value>\S*)$`)
)

Functions

func MergeConfigurations

func MergeConfigurations(dst *Configuration, src Configuration) error

MergeConfigurations merges two configurations into one, any existing values will be overridden

Types

type Configuration

type Configuration map[string]interface{}

Configuration is a map used to render the templates with

func All

func All(configPaths, vars []string) (Configuration, error)

All creates a configuration from one or more configuration file paths and one or more extra variables in addition to base configuration

func Base

func Base() (Configuration, error)

Base creates a basic configuration required for some of the functions, it is recommended to use it

func New

func New(configs ...Configuration) Configuration

New creates a new configuration from one or more configurations, to be used with other helper functions

func WithFiles

func WithFiles(configPaths []string) (Configuration, error)

WithFiles creates a configuration from one or more configuration file paths

func WithVars

func WithVars(extraParams []string) (Configuration, error)

WithVars creates a configuration from one or more extra variables (key=value), see also VarArgRegexp

func (Configuration) Validate added in v0.0.5

func (configurations Configuration) Validate() error

Validate checks the internal state and returns error if necessary

Jump to

Keyboard shortcuts

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