config

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0 Imports: 17 Imported by: 31

Documentation

Index

Constants

View Source
const (
	// ConfigFileType is the type of config file we use.
	ConfigFileType = "yaml"

	// ConfigFileName is the name of the configuration file, without ending.
	ConfigFileName = "config"

	// ConfigFilePermission is the rights mask for the config file.
	ConfigFilePermission = 0600

	// ProgramName is the name of this program.
	ProgramName = "gsctl"

	// VersionCheckURL is the URL telling us what the latest gsctl version is.
	VersionCheckURL = "https://github.com/giantswarm/gsctl/releases/latest"

	// VersionCheckInterval is the minimum time to wait between two version checks.
	VersionCheckInterval = time.Hour * 24
)

Variables

View Source
var (
	// Config is an object holding all configuration fields.
	Config = newConfigStruct()

	// Version is the version number, to be set on build by the go linker.
	Version string

	// BuildDate is the build date, to be set on build by the go linker.
	BuildDate string

	// Commit is the latest git commit hash, to be set on build by the go linker.
	Commit string

	// FileSystem is the afero filesystem used to store the config file and certificates.
	FileSystem afero.Fs

	// HomeDirPath is the path to the user's home directory.
	HomeDirPath string

	// DefaultConfigDirPath is the default config dir path to use.
	DefaultConfigDirPath string

	// ConfigDirPath is the actual path of the config dir.
	ConfigDirPath string

	// CertsDirPath is the path of the directory holding certificates.
	CertsDirPath string

	// ConfigFilePath is the path of the configuration file.
	ConfigFilePath string

	// KubeConfigPaths is the path(s) of kubeconfig files as slice of strings.
	KubeConfigPaths []string

	// SystemUser is the current system user as user.User (os/user).
	SystemUser *user.User
)

Functions

func GarbageCollectKeyPairs

func GarbageCollectKeyPairs(fs afero.Fs) error

GarbageCollectKeyPairs removes files from expired key pairs.

func Initialize

func Initialize(fs afero.Fs, configDirPath string) error

Initialize sets up all configuration. It's distinct from init() on purpose, so it's execution can be triggered in a controlled way. It's supposed to be called after init(). The configDirPath argument can be given to override the DefaultConfigDirPath.

func InitializeWithLogger added in v0.2.3

func InitializeWithLogger(fs afero.Fs, configDirPath string, loggerToUse io.Writer) error

InitializeWithLogger sets up all configuration. It's distinct from init() on purpose, so it's execution can be triggered in a controlled way. It's supposed to be called after init(). The configDirPath argument can be given to override the DefaultConfigDirPath. the loggerToUse argument specifies the io.Writer to write log messages to.

func IsAliasMustBeUniqueError

func IsAliasMustBeUniqueError(err error) bool

IsAliasMustBeUniqueError asserts aliasMustBeUniqueError.

func IsCredentialsRequiredError

func IsCredentialsRequiredError(err error) bool

IsCredentialsRequiredError asserts credentialsRequiredError.

func IsEndpointNotDefinedError

func IsEndpointNotDefinedError(err error) bool

IsEndpointNotDefinedError asserts endpointNotDefinedError.

func IsEndpointProviderIsImmuttableError

func IsEndpointProviderIsImmuttableError(err error) bool

IsEndpointProviderIsImmuttableError asserts endpointProviderIsImmuttableError.

func IsGarbageCollectionFailedError

func IsGarbageCollectionFailedError(err error) bool

IsGarbageCollectionFailedError asserts garbageCollectionFailedError.

func IsGarbageCollectionPartiallyFailedError

func IsGarbageCollectionPartiallyFailedError(err error) bool

IsGarbageCollectionPartiallyFailedError asserts garbageCollectionPartiallyFailedError.

func IsNoEndpointSelectedError

func IsNoEndpointSelectedError(err error) bool

IsNoEndpointSelectedError asserts noEndpointSelectedError.

func IsUnableToRefreshTokenErrorr

func IsUnableToRefreshTokenErrorr(err error) bool

IsUnableToRefreshTokenErrorr asserts unableToRefreshTokenError.

func UserAgent

func UserAgent() string

UserAgent returns the user agent string identifying us in HTTP requests.

func WriteToFile

func WriteToFile() error

WriteToFile writes the configuration data to a YAML file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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