config

package
v1.3.24 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Config is the CLI configuration structure
	Config Configuration

	// ProcessedConfig holds all the calculated values
	ProcessedConfig ProcessedConfiguration
)

Functions

func GetContextPrefix added in v1.3.5

func GetContextPrefix(stack string, context Context, stackNamePattern string) (string, error)

GetContextPrefix calculates context prefix

func InitConfig

func InitConfig() error

InitConfig finds and merges CLI configurations in the following order: system dir, home dir, current dir, ENV vars, command-line arguments https://dev.to/techschoolguru/load-config-from-file-environment-variables-in-golang-with-viper-2j2d https://medium.com/@bnprashanth256/reading-configuration-files-and-environment-variables-in-go-golang-c2607f912b63

func ProcessConfig

func ProcessConfig(configAndStacksInfo ConfigAndStacksInfo) error

ProcessConfig processes and checks CLI configuration

func ProcessConfigForSpacelift added in v1.3.5

func ProcessConfigForSpacelift() error

ProcessConfigForSpacelift processes config for Spacelift

func ReplaceContextTokens added in v1.3.5

func ReplaceContextTokens(context Context, pattern string) string

ReplaceContextTokens replaces tokens in the context pattern

Types

type ArgsAndFlagsInfo

type ArgsAndFlagsInfo struct {
	AdditionalArgsAndFlags  []string
	SubCommand              string
	ComponentFromArg        string
	GlobalOptions           []string
	TerraformDir            string
	HelmfileDir             string
	ConfigDir               string
	StacksDir               string
	BasePath                string
	DeployRunInit           string
	AutoGenerateBackendFile string
	UseTerraformPlan        bool
	NeedHelp                bool
}

type Components

type Components struct {
	Terraform Terraform
	Helmfile  Helmfile
}

type ConfigAndStacksInfo

type ConfigAndStacksInfo struct {
	Stack                     string
	ComponentFromArg          string
	ComponentFolderPrefix     string
	ComponentNamePrefix       string
	Component                 string
	BaseComponentPath         string
	BaseComponent             string
	Command                   string
	SubCommand                string
	ComponentVarsSection      map[interface{}]interface{}
	ComponentEnvSection       map[interface{}]interface{}
	ComponentEnvList          []string
	ComponentBackendSection   map[interface{}]interface{}
	ComponentBackendType      string
	AdditionalArgsAndFlags    []string
	GlobalOptions             []string
	BasePath                  string
	TerraformDir              string
	HelmfileDir               string
	ConfigDir                 string
	StacksDir                 string
	Context                   Context
	ContextPrefix             string
	DeployRunInit             string
	AutoGenerateBackendFile   string
	UseTerraformPlan          bool
	ComponentInheritanceChain []string
	NeedHelp                  bool
	ComponentIsAbstract       bool
	ComponentMetadataSection  map[interface{}]interface{}
	TerraformWorkspace        string
}

type Configuration

type Configuration struct {
	BasePath   string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	Components Components
	Stacks     Stacks
	Logs       Logs
}

type Context

type Context struct {
	Namespace   string
	Tenant      string
	Environment string
	Stage       string
	Region      string
}

func GetContextFromVars added in v1.3.5

func GetContextFromVars(vars map[interface{}]interface{}) Context

GetContextFromVars creates a context object from the provided variables

type Helmfile

type Helmfile struct {
	BasePath              string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	KubeconfigPath        string `yaml:"kubeconfig_path" json:"kubeconfig_path" mapstructure:"kubeconfig_path"`
	HelmAwsProfilePattern string `yaml:"helm_aws_profile_pattern" json:"helm_aws_profile_pattern" mapstructure:"helm_aws_profile_pattern"`
	ClusterNamePattern    string `yaml:"cluster_name_pattern" json:"cluster_name_pattern" mapstructure:"cluster_name_pattern"`
}

type Logs

type Logs struct {
	Verbose bool `yaml:"verbose" json:"verbose" mapstructure:"verbose"`
	Colors  bool `yaml:"colors" json:"colors" mapstructure:"colors"`
}

type ProcessedConfiguration

type ProcessedConfiguration struct {
	StacksBaseAbsolutePath        string   `yaml:"StacksBaseAbsolutePath" json:"StacksBaseAbsolutePath"`
	IncludeStackAbsolutePaths     []string `yaml:"IncludeStackAbsolutePaths" json:"IncludeStackAbsolutePaths"`
	ExcludeStackAbsolutePaths     []string `yaml:"ExcludeStackAbsolutePaths" json:"ExcludeStackAbsolutePaths"`
	TerraformDirAbsolutePath      string   `yaml:"TerraformDirAbsolutePath" json:"TerraformDirAbsolutePath"`
	HelmfileDirAbsolutePath       string   `yaml:"HelmfileDirAbsolutePath" json:"HelmfileDirAbsolutePath"`
	StackConfigFilesRelativePaths []string `yaml:"StackConfigFilesRelativePaths" json:"StackConfigFilesRelativePaths"`
	StackConfigFilesAbsolutePaths []string `yaml:"StackConfigFilesAbsolutePaths" json:"StackConfigFilesAbsolutePaths"`
	StackType                     string   `yaml:"StackType" json:"StackType"`
}

type Stacks

type Stacks struct {
	BasePath      string   `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	IncludedPaths []string `yaml:"included_paths" json:"included_paths" mapstructure:"included_paths"`
	ExcludedPaths []string `yaml:"excluded_paths" json:"excluded_paths" mapstructure:"excluded_paths"`
	NamePattern   string   `yaml:"name_pattern" json:"name_pattern" mapstructure:"name_pattern"`
}

type Terraform

type Terraform struct {
	BasePath                string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	ApplyAutoApprove        bool   `yaml:"apply_auto_approve" json:"apply_auto_approve" mapstructure:"apply_auto_approve"`
	DeployRunInit           bool   `yaml:"deploy_run_init" json:"deploy_run_init" mapstructure:"deploy_run_init"`
	AutoGenerateBackendFile bool   `yaml:"auto_generate_backend_file" json:"auto_generate_backend_file" mapstructure:"auto_generate_backend_file"`
}

Jump to

Keyboard shortcuts

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