config

package
v0.0.0-...-149f271 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultConfigName = "sparta.yml"

the default file name of the configuration file

View Source
const ViperS3Key = "s3key"

viper keys for configuration to be passed in

View Source
const ViperS3Region = "s3region"
View Source
const ViperS3Secret = "s3secret"
View Source
const ViperS3Url = "s3url"

Variables

This section is empty.

Functions

func WriteConfig

func WriteConfig(config SpartaConfig, fullPath string) error

Types

type Cloud

type Cloud struct {
	Provider    string
	Region      string
	VpcId       string `mapstructure:"vpc-id"`
	CidrPrivate string `mapstructure:"cidr-private"`
}

Cloud is information on the target cloud environment and the VPCs that

are created there

type Cluster

type Cluster struct {
	Target        string
	VpcName       string `mapstructure:"vpc-name"`
	ClusterName   string `mapstructure:"cluster-name"`
	BaseDomain    string `mapstructure:"base-domain"`
	ClusterDomain string `mapstructure:"cluster-domain"`
	AmiId         string `mapstructure:"ami-id"`
}

Cluster defines the cluster logical details like names and networking

type EnvironmentVariable

type EnvironmentVariable struct {
	Name  string
	Value string
}

An EnvironmentVariable is a struct that holds a name/value pair because a straight-up map[string]string

can't be used since viper keys are case insensitive and will be all lower case in the
map resulting to unexpected behavior in the plugin
see: https://github.com/spf13/viper/issues/411
and: https://github.com/spf13/viper/issues/373

func (EnvironmentVariable) Pair

func (env EnvironmentVariable) Pair() string

Pair converts the name/value into the name=value format that is expected

when the command is being run

type EnvironmentVariables

type EnvironmentVariables []EnvironmentVariable

EnvironmentVariables is a slice of name->values that is used to send environment

to the execution of a plugin. This is used in place of a map
because viper keys are case-insensitive and the resulting map
would all be lowercase

func (EnvironmentVariables) List

func (vars EnvironmentVariables) List() []string

List creates a slice of "name=value" pairs that is suitable for use with the

plugin command.

func (EnvironmentVariables) Map

func (vars EnvironmentVariables) Map() map[string]string

Map creates a map of values matching the map[name]value structure

type Koffer

type Koffer struct {
	Silent  bool
	Plugins Plugins
}

Koffer is a collector for CodeSparta artifacts

type OpenShift

type OpenShift struct {
	Version string
}

OpenShift defines the openshift configuration details related to artifacts and sources

type Plugin

type Plugin struct {
	Version      string
	Service      string
	Organization string
	Branch       string
	Env          EnvironmentVariables
}

Plugin is a struct that defines details about a Koffer plugin, it's

source, version, and other details for Koffer to collect

type Plugins

type Plugins map[string]Plugin

Plugins is a map that names plugins to their source

type ProviderAuth

type ProviderAuth struct {
	Keys   bool
	Secret string
	Key    string
}

ProviderAuth is the authentication structure for the provider (such as AWS)

type RedSord

type RedSord struct {
	Enabled bool
}

RedSord

type SpartaConfig

type SpartaConfig struct {
	OpenShift    OpenShift
	Cluster      Cluster
	Cloud        Cloud
	Subnets      Subnets
	ProviderAuth ProviderAuth `mapstructure:"provider-auth"`
	RedSord      RedSord
	Koffer       Koffer
}

SpartaConfig is the holder for all of the parts of the configuration

func DefaultConfig

func DefaultConfig() SpartaConfig

DefaultConfig creates a default configuration where any values that

need to default to "non-empty" values (like booleans)
or strings can be set and so that the maps and arrays
are already constructed to prevent issues with unsafe
reads of the configuration

func NewSpartaConfig

func NewSpartaConfig(configUrl string, searchPaths ...string) (*SpartaConfig, error)

NewSpartaConfig creates a configuration from the given file name and searches

the list of locations for that file.

func ViperSpartaConfig

func ViperSpartaConfig(viperInstance *viper.Viper, configUrl string, searchPaths ...string) (*SpartaConfig, error)

ViperSpartaConfig takes a viper instance, configures it for Sparta configuration using the given paths and search

location and loads the values into the viper instance as well as returning the configuration

type SubnetGroup

type SubnetGroup []string

SubnetGroup is a list of VPC subnet IDs

type Subnets

type Subnets map[string]SubnetGroup

Subnets is a map of names (private/public) to a list of subnet ids (SubnetGroup) found

in that subnet name

Jump to

Keyboard shortcuts

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