cliconfig

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContextNotFound              = errors.New("context not found")
	ErrContextAlreadyExistsWithName = errors.New("context already exists with the same name")
)

Functions

This section is empty.

Types

type Config

type Config struct {

	// The current active context
	Current string `yaml:"current"`
	// The available contexts
	Contexts []Context `yaml:"contexts"`
	// contains filtered or unexported fields
}

func Load

func Load() (*Config, error)

Load the Configuration from the host environment.

func (*Config) AddContext

func (c *Config) AddContext(context *Context) error

AddContext add the given context to the list of known contexts

func (*Config) GetContext

func (c *Config) GetContext(name string) (*Context, error)

GetContext returns the context associated with the given name.

func (*Config) GetCurrentContext

func (c *Config) GetCurrentContext() (*Context, error)

GetCurrentContext returns the current context

func (*Config) Save

func (c *Config) Save() error

func (*Config) UseContext

func (c *Config) UseContext(name string) error

UseContext set the current context to the given context

type Context

type Context struct {
	// The name of the current context
	Name string `yaml:"name"`
	// The address of the controller
	Controller string `yaml:"controller"`
	// The address of the registry
	Registry string `yaml:"registry"`
}

Context holds information about a single Morty instance.

type ControllerClientContextKey added in v1.1.0

type ControllerClientContextKey struct{}

type CtxKey

type CtxKey struct{}

type CurrentCtxKey

type CurrentCtxKey struct{}

type RegistryClientContextKey added in v1.1.0

type RegistryClientContextKey struct{}

Jump to

Keyboard shortcuts

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