Documentation ¶
Overview ¶
Package config defines data structure and logic for loading and refreshing configurations for Honeydipper
Index ¶
- func CollapseTrigger(t *Trigger, c *DataSet) (*Trigger, *CollapsedTrigger)
- func ExportFunctionContext(f *Function, envData map[string]interface{}, cfg *Config) map[string]interface{}
- func GetGitSSHAuth() transport.AuthMethod
- type Action
- type CollapsedTrigger
- type Config
- type DataSet
- type Error
- type Event
- type Function
- type Repo
- type RepoInfo
- type Rule
- type System
- type Trigger
- type Workflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollapseTrigger ¶ added in v1.0.0
func CollapseTrigger(t *Trigger, c *DataSet) (*Trigger, *CollapsedTrigger)
CollapseTrigger collapses matching criteria, exports and sysData of a trigger and its inheritted triggers
func ExportFunctionContext ¶ added in v1.5.0
func ExportFunctionContext(f *Function, envData map[string]interface{}, cfg *Config) map[string]interface{}
ExportFunctionContext create a context data structure based on the collapsed function exports
func GetGitSSHAuth ¶
func GetGitSSHAuth() transport.AuthMethod
GetGitSSHAuth creates an AuthMethod to be used for various git operations
Types ¶
type CollapsedTrigger ¶ added in v1.0.0
type CollapsedTrigger struct { Match map[string]interface{} `json:"match"` Exports []map[string]interface{} `json:"exports"` SysData map[string]interface{} `json:"sysData"` Parameters map[string]interface{} `json:"parameters"` }
CollapsedTrigger is a trigger with collapsed matching criteria, parameters, merged sysData and stack of exports
func (*CollapsedTrigger) ExportContext ¶ added in v1.0.0
func (t *CollapsedTrigger) ExportContext(eventName string, envData map[string]interface{}) map[string]interface{}
ExportContext putting raw data from event into context as abstracted fields
type Config ¶
type Config struct { InitRepo RepoInfo Services []string DataSet *DataSet Loaded map[RepoInfo]*Repo WorkingDir string LastRunningConfig struct { DataSet *DataSet Loaded map[RepoInfo]*Repo } OnChange func() IsConfigCheck bool CheckRemote bool IsDocGen bool DocSrc string DocDst string }
Config is a wrapper around the final complete configration of the daemon including history and the runtime information
func (*Config) Bootstrap ¶
Bootstrap loads the configuration during daemon bootstrap. WorkingDir is where git will clone remote repo into.
func (*Config) GetDriverData ¶
GetDriverData gets an item from a driver's data block.
conn,ok := c.GetDriverData("redis.connection")
The function returns an interface{} that could be anything.
func (*Config) GetDriverDataStr ¶
GetDriverDataStr gets an item from a driver's data block.
logLevel,ok := c.GetDriverData("daemon.loglevel")
The function assume the return value is a string will do a type assertion upon returning.
func (*Config) Refresh ¶
func (c *Config) Refresh()
Refresh checks remote git remote, reload if changes are detected. It requires that the OnChange variable is defined prior to invoking the function.
type DataSet ¶
type DataSet struct { Systems map[string]System Rules []Rule Drivers map[string]interface{} Includes []string Repos []RepoInfo Workflows map[string]Workflow Contexts map[string]interface{} }
DataSet is a subset of configuration that can be assembled to the complete final configuration.
type Function ¶
type Function struct { Driver string RawAction string Parameters map[string](interface{}) // An action should have only one of target action or a raw action. Target Action Export map[string]interface{} ExportOnSuccess map[string]interface{} `json:"export_on_success" mapstructure:"export_on_success"` ExportOnFailure map[string]interface{} `json:"export_on_failure" mapstructure:"export_on_failure"` Description string Meta interface{} }
Function is the datastructure hold the information to run actions.
type System ¶
type System struct { Data map[string](interface{}) Triggers map[string]Trigger Functions map[string]Function Extends []string Description string Meta interface{} }
System is an abstract construct to group data, trigger and function definitions.
func SystemCopy ¶
SystemCopy performs a deep copy of the given system
type Trigger ¶
type Trigger struct { Driver string RawEvent string Match map[string]interface{} `json:"if_match" mapstructure:"if_match"` Parameters map[string]interface{} // A trigger should have only one of source event a raw event. Source Event Export map[string]interface{} Description string Meta interface{} }
Trigger is the datastructure hold the information to match and process an event.
type Workflow ¶
type Workflow struct { Name string Description string Meta interface{} Context string Contexts interface{} Local map[string]interface{} `json:"with" mapstructure:"with"` Match interface{} `json:"if_match" mapstructure:"if_match"` UnlessMatch interface{} `json:"unless_match" mapstructure:"unelss_match"` WhileMatch interface{} `json:"while_match" mapstructure:"while_match"` UntilMatch interface{} `json:"until_match" mapstructure:"until_match"` If []string IfAny []string `json:"if_any" mapstructure:"if_any"` Unless []string UnlessAll []string `json:"unless_any" mapstructure:"unless_all"` While []string WhileAny []string `json:"while_any" mapstructure:"while_any"` Until []string UntilAll []string `json:"until_any" mapstructure:"until_all"` Else interface{} `json:"else,omitempty"` Iterate interface{} IterateParallel interface{} `json:"iterate_parallel" mapstructure:"iterate_parallel"` IterateAs string `json:"iterate_as" mapstructure:"iterate_as"` Retry string Backoff string OnError string `json:"on_error" mapstructure:"on_error"` OnFailure string `json:"on_failure" mapstructure:"on_failure"` Workflow string `json:"call_workflow" mapstructure:"call_workflow"` Function Function CallFunction string `json:"call_function" mapstructure:"call_function"` CallDriver string `json:"call_driver" mapstructure:"call_driver"` Steps []Workflow Threads []Workflow Wait string Switch string Cases map[string]interface{} Default interface{} Export map[string]interface{} ExportOnSuccess map[string]interface{} `json:"export_on_success" mapstructure:"export_on_success"` ExportOnFailure map[string]interface{} `json:"export_on_failure" mapstructure:"export_on_failure"` NoExport []string `json:"no_export" mapstructure:"no_export"` }
Workflow defines one or more actions needed to complete certain task and how they are orchestrated.