config

package
v0.0.0-...-fd200ee Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreprocessContent

func PreprocessContent(content []byte, vars map[string]any) ([]byte, error)

PreprocessContent processes a gotemplate from memory

func PreprocessContentIntoWriter

func PreprocessContentIntoWriter(content []byte, vars map[string]any, writer io.Writer) error

func PreprocessFile

func PreprocessFile(templateFilePath string, vars map[string]any) ([]byte, error)

PreprocessFile reads and processes a gotemplate The path will be read as is. It parses the file as a template, and executes it with the provided variables.

Types

type ConfigProvider

type ConfigProvider interface {
	Validate(cloud, deployEnv string) error
	GetVariables(cloud, deployEnv, region string, configReplacements *ConfigReplacements) (Variables, error)
	GetDeployEnvVariables(cloud, deployEnv string, configReplacements *ConfigReplacements) (Variables, error)
	GetRegions(cloud, deployEnv string) ([]string, error)
	GetRegionOverrides(cloud, deployEnv, region string, configReplacements *ConfigReplacements) (Variables, error)
}

func NewConfigProvider

func NewConfigProvider(config string) ConfigProvider

type ConfigReplacements

type ConfigReplacements struct {
	RegionReplacement      string
	RegionShortReplacement string
	StampReplacement       string
}

func DefaultConfigReplacements

func DefaultConfigReplacements() *ConfigReplacements

func NewConfigReplacements

func NewConfigReplacements(regionReplacement, regionShortReplacement, stampReplacement string) *ConfigReplacements

func (*ConfigReplacements) AsMap

func (c *ConfigReplacements) AsMap() map[string]interface{}

type VariableOverrides

type VariableOverrides interface {
	GetDefaults() Variables
	GetCloudOverrides(cloud string) Variables
	GetDeployEnvOverrides(cloud, deployEnv string) Variables
	GetRegionOverrides(cloud, deployEnv, region string) Variables
	GetRegions(cloud, deployEnv string) []string
	GetSchema() string
	HasSchema() bool
	HasCloud(cloud string) bool
	HasDeployEnv(cloud, deployEnv string) bool
}

func NewVariableOverrides

func NewVariableOverrides() VariableOverrides

type Variables

type Variables map[string]any

func InterfaceToVariables

func InterfaceToVariables(i interface{}) (Variables, bool)

func MergeVariables

func MergeVariables(base, override Variables) Variables

Merges variables, returns merged variables However the return value is only used for recursive updates on the map The actual merged variables are updated in the base map

func (Variables) GetByPath

func (v Variables) GetByPath(path string) (any, bool)

Jump to

Keyboard shortcuts

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