Documentation ¶
Index ¶
- Constants
- Variables
- func Exclude(exclusionList []string, linkMap map[string]*Link) map[string]*Link
- func InList(s string, ss []string) bool
- func IsEnvFile(path string) bool
- func IsJSONFile(path string) bool
- func IsSimpleValue(i interface{}) bool
- func IsTOMLFile(path string) bool
- func IsYAMLFile(path string) bool
- func OutputCfg(link *Link, outputType Format) (interface{}, error)
- func SimpleValueToString(i interface{}) (str string, err error)
- type CfgMap
- type Format
- type Gear
- type Link
- type LinkFilter
- type ReadType
- type Resolver
- type Visitor
Constants ¶
const (
ErrNoEncAndNoDecrypt = errConst("NoEnc and NoDecrypt cannot both be true")
)
Errors raised by package x.
Variables ¶
var DefaultMethod string = http.MethodGet
DefaultMethod uses GET for the default request type
var EnvSubst bool = false
EnvSubst decides whether to use environmental substitution or not
var NoDecrypt bool = false
NoDecrypt decides whether to decrypt encrypted values, not compatible with NoEnc
var NoEnc bool = false
NoEnc decides whether to handle encrypted variables
var RecursionLimit int = 12
RecursionLimit is the limit used to define when to abort successive traversals of gears
Functions ¶
func IsJSONFile ¶
IsJSONFile returns true if a given file path corresponds to a JSON file
func IsSimpleValue ¶
func IsSimpleValue(i interface{}) bool
IsSimpleValue is intended to see if the underlying value allows a flat map to be retained
func IsTOMLFile ¶
IsTOMLFile returns true if a given file path corresponds to a TOML file
func IsYAMLFile ¶
IsYAMLFile returns true if a given file path corresponds to a YAML file
func SimpleValueToString ¶
SimpleValueToString converts an underlying type to a string, returning an error if it is not a simple value
Types ¶
type CfgMap ¶
type CfgMap map[string]interface{}
CfgMap is meant to represent a map with values of one or more unknown types
type Format ¶
type Format string
Format represents the final marshalled k/v output type from a resolved Gear TODO reconcile readType and Format patterns
const ( JSON Format = "json" YAML Format = "yaml" TOML Format = "toml" Dotenv Format = "dotenv" List Format = "list" // omit keys )
Formats for respective object notation
func FormatForPath ¶
FormatForPath returns the correct format given the path to a file
func FormatLinkInput ¶
FormatLinkInput returns the correct format given the readType
type Gear ¶
type Gear struct { Name string // contains filtered or unexported fields }
Gear represents one of the contexts in a cog manifest. The term "gear" is used to refer to the operating state of a machine (similar to how a microservice can operate locally or in a remote environment) rather than a gear object. The term "switching gears" is an apt representation of how one Cog manifest file can have many contexts/environments
func (*Gear) ResolveMap ¶
ResolveMap outputs the flat associative string, resolving potential filepath pointers held by Link objects by calling the .SetValue() method
type Link ¶
type Link struct { KeyName string // the key name defined in the context file SearchName string // same as keyName unless redefined using the `name` key: var.name="other_name" Value interface{} // Holds a complex or simple value for the given Link Path string // filepath string where Link can be resolved SubPath string // object traversal string used to resolve Link if not at top level of document (yq syntax) // contains filtered or unexported fields }
Link holds all the data needed to resolve one string key value pair
type LinkFilter ¶
LinkFilter if a function meant to filter a LinkMap
type ReadType ¶
type ReadType string
ReadType represents the logic used to derive the deserliazied value for a given Link
type Resolver ¶
Resolver is meant to define an object that returns the final string map to be used in a configuration resolving any paths and sub paths defined in the underling config map
type Visitor ¶
Visitor allows a query path to return the underlying value for a given visitor
func NewDotenvVisitor ¶
NewDotenvVisitor returns a visitor object that satisfies the Visitor interface attempting to turn a supposed dotenv byte slice into a *yaml.Node object
func NewJSONVisitor ¶
NewJSONVisitor returns a visitor object that satisfies the Visitor interface attempting to turn a supposed JSON byte slice into a *yaml.Node object
func NewTOMLVisitor ¶
NewTOMLVisitor returns a visitor object that satisfies the Visitor interface attempting to turn a supposed TOML byte slice into a *yaml.Node object
func NewYAMLVisitor ¶
NewYAMLVisitor returns a visitor object that satisfies the Visitor interface