config

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0 Imports: 18 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 InitConfig

func InitConfig(configAndStacksInfo ConfigAndStacksInfo) error

InitConfig processes and merges 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

Types

type ArgsAndFlagsInfo

type ArgsAndFlagsInfo struct {
	AdditionalArgsAndFlags []string
	SubCommand             string
	ComponentFromArg       string
	GlobalOptions          []string
	TerraformDir           string
	HelmfileDir            string
	ConfigDir              string
	StacksDir              string
	DeployRunInit          string
}

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{}
	ComponentBackendSection map[interface{}]interface{}
	AdditionalArgsAndFlags  []string
	GlobalOptions           []string
	TerraformDir            string
	HelmfileDir             string
	ConfigDir               string
	StacksDir               string
	Context                 Context
	ContextPrefix           string
	DeployRunInit           string
}

type Configuration

type Configuration struct {
	Components Components
	Stacks     Stacks
	Logs       Logs
}

type Context

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

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"`
}

Jump to

Keyboard shortcuts

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