conf

package
v0.0.0-...-21d6f6e Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package for managing configuration objects. This works by fetching and overlaying multiple templates onto an object.

Index

Constants

This section is empty.

Variables

View Source
var (
	InitialDataContextKey    initialDataContextKey    = 1
	ConfigDataTypeContextKey configDataTypeContextKey = 2
)

Functions

func Configure

func Configure(ctx context.Context, conf Conf, target interface{}, optionalFuncs ...template.FuncMap) error

Run the configuration specified in conf against the target. This will run a series of template fetching, applying templates, unmarshaling of the final applied template onto the given target object. After unmarshaling is done, the target's fields are examined one by one, by tag, and fields that have template as values are then applied.

func ContextGetConfigDataType

func ContextGetConfigDataType(ctx context.Context) encoding.ContentType

func ContextGetInitialData

func ContextGetInitialData(ctx context.Context) interface{}

func ContextPutConfigDataType

func ContextPutConfigDataType(ctx context.Context, t encoding.ContentType) context.Context

func ContextPutInitialData

func ContextPutInitialData(ctx context.Context, data interface{}) context.Context

func NewFuncMap

func NewFuncMap() fmap

Types

type Conf

type Conf struct {
	Urls []string `flag:"conf.url, Url to fetch for configuration data"`

	// Called when a layer of resource has been applied as template
	OnDoneExecuteLayer func(c *Conf, url string, result []byte, err error) `json:"-" yaml:"-"`

	// Called when a layer of resource has been unmarshaled onto the generic model
	OnDoneUnmarshalLayer func(c *Conf, url string, err error) `json:"-" yaml:"-"`

	// Called when all the fetching and layering has been applied to a generic model
	OnDoneFetching func(c *Conf) `json:"-" yaml:"-"`

	// Called when the generic document model has been constructed, layered, and serialized
	OnDoneSerialize func(c *Conf, err error) `json:"-" yaml:"-"`

	// Called when the model has been generated to a composite document and unmarshaled onto the target object
	OnDoneUnmarshal func(c *Conf, target interface{}) `json:"-" yaml:"-"`
	// contains filtered or unexported fields
}

func (*Conf) Document

func (this *Conf) Document() []byte

func (*Conf) Model

func (this *Conf) Model() map[string]interface{}

Jump to

Keyboard shortcuts

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