Documentation ¶
Overview ¶
Package for managing configuration objects. This works by fetching and overlaying multiple templates onto an object.
Index ¶
- Variables
- func Configure(ctx context.Context, conf Conf, target interface{}, ...) error
- func ContextGetConfigDataType(ctx context.Context) encoding.ContentType
- func ContextGetInitialData(ctx context.Context) interface{}
- func ContextPutConfigDataType(ctx context.Context, t encoding.ContentType) context.Context
- func ContextPutInitialData(ctx context.Context, data interface{}) context.Context
- func NewFuncMap() fmap
- type Conf
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 ContextPutInitialData ¶
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 }
Click to show internal directories.
Click to hide internal directories.