config

package
v0.0.0-...-0f323ce Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Username on continuous pipe
	Username = "username"

	//ApiKey of the user
	ApiKey = "api-key"

	//CpAuthenticatorApiAddr target address for cp api calls in the format protocol://host:port
	CpAuthenticatorApiAddr = "cp-authenticator-api-addr"

	//CpRiverApiAddr target address for cp api calls in the format protocol://host:port
	CpRiverApiAddr = "cp-river-api-addr"

	//CpKubeProxyAddr target address for cp proxy in the format protocol://host:port
	CpKubeProxyAddr = "cp-kube-proxy-addr"

	//CpLogProxyAddr target address for the cp log proxy in the format protocol://host:port
	CpLogProxyAddr = "cp-log-proxy-addr"

	//AwsS3BucketAddr address of the cp-remote client aws s3 bucket in the format protocol://host:port
	AwsS3BucketAddr = "aws-s3-bucket-addr"
)
View Source
const (
	InitToken           = "init-token"
	FlowId              = "flow-id"
	ClusterIdentifier   = "cluster-identifier"
	KubeEnvironmentName = "kube-environment-name"
	RemoteName          = "remote-name"
	RemoteBranch        = "remote-branch"
	Service             = "service"
	AnybarPort          = "anybar-port"
	RemoteEnvironmentId = "remote-environment-id"
	InitStatus          = "init-status"

	//settings to disable the kube proxy if required
	CpKubeProxyEnabled        = "kube-proxy-enabled"
	KubeDirectClusterAddr     = "kube-direct-cluster-addr"
	KubeDirectClusterUser     = "kube-direct-cluster-user"
	KubeDirectClusterPassword = "kube-direct-cluster-password"
)
View Source
const GitIgnore = ".gitignore"
View Source
const KubeCtlName = "kubectl"

Variables

View Source
var AppName = os.Args[0]
View Source
var CurrentVersion string

The current version is assigned via ldflags, see Makefile

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

allows to fetch settings either from global or local config

var C *Config

func NewConfig

func NewConfig() *Config

func (*Config) ConfigFileUsed

func (c *Config) ConfigFileUsed(configType ConfigType) (string, error)

set the config file used for the given config type

func (*Config) GetBool

func (c *Config) GetBool(key string) (bool, error)

get the bool value on global or local depending who handles it

func (*Config) GetString

func (c *Config) GetString(key string) (string, error)

get the string value on global or local depending who handles it

func (*Config) GetStringQ

func (c *Config) GetStringQ(key string) string

GetStringQ calls GetString returning empty if there key didn't match a config handler

func (*Config) ReadInConfig

func (c *Config) ReadInConfig(configType ConfigType) error

reads from the viper config specified in the configType

func (*Config) Save

func (c *Config) Save(configType ConfigType) error

save the local and global settings on disk

func (*Config) Set

func (c *Config) Set(key string, value interface{}) error

set the key value on global or local depending who handles it

func (*Config) SetConfigFile

func (c *Config) SetConfigFile(configType ConfigType, in string) error

set the config file for the given config type

func (*Config) SetConfigPath

func (c *Config) SetConfigPath(configType ConfigType, in string) error

set the config path for the given config type

func (Config) Validate

func (c Config) Validate() (missingSettings []string, ok bool)

check if all mandatory settings are set for both config types

type ConfigProvider

type ConfigProvider interface {
	Set(key string, value interface{}) error
	GetBool(key string) (bool, error)
	GetString(key string) (string, error)
	GetStringQ(key string) string
	SetConfigFile(configType ConfigType, in string) error
	SetConfigPath(configType ConfigType, in string) error
	ConfigFileUsed(configType ConfigType) (string, error)
	ReadInConfig(configType ConfigType) error
	Save(configType ConfigType) error
}

type ConfigType

type ConfigType string
const (
	LocalConfigType  ConfigType = "local"
	GlobalConfigType ConfigType = "global"
	AllConfigTypes   ConfigType = "all"
)

type Ignore

type Ignore struct {
	File string
	List []string
}

func NewIgnore

func NewIgnore() *Ignore

func (*Ignore) AddToIgnore

func (i *Ignore) AddToIgnore(fileNames ...string) (bool, error)

func (*Ignore) AlreadyIgnored

func (i *Ignore) AlreadyIgnored(s string) bool

func (*Ignore) LoadFromIgnoreFile

func (i *Ignore) LoadFromIgnoreFile() error

type Setting

type Setting struct {
	Name         string
	DefaultValue string
	Mandatory    bool
}

Jump to

Keyboard shortcuts

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