Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

DefaultConfigPath returns the default config file path

func SaveConfig

func SaveConfig(config *Config, path string) error

SaveConfig saves the configuration to the specified path

Types

type Cluster

type Cluster struct {
	Address         string `yaml:"address"`
	TLSCAPath       string `yaml:"tls-ca-path,omitempty"`
	TLSCertPath     string `yaml:"tls-cert-path,omitempty"`
	TLSKeyPath      string `yaml:"tls-key-path,omitempty"`
	UseLegacyRoutes bool   `yaml:"use-legacy-routes,omitempty"`
	RulerAPIPath    string `yaml:"ruler-api-path,omitempty"`
}

Cluster contains cluster connection information

type Config

type Config struct {
	CurrentContext string         `yaml:"current-context"`
	Contexts       []NamedContext `yaml:"contexts"`
	Clusters       []NamedCluster `yaml:"clusters"`
	Users          []NamedUser    `yaml:"users"`
}

Config represents the cortextool configuration file structure

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads the configuration from the specified path

func (*Config) DeleteCluster

func (c *Config) DeleteCluster(name string) bool

DeleteCluster removes a cluster

func (*Config) DeleteContext

func (c *Config) DeleteContext(name string) bool

DeleteContext removes a context

func (*Config) DeleteUser

func (c *Config) DeleteUser(name string) bool

DeleteUser removes a user

func (*Config) GetContext

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

GetContext returns a specific context by name

func (*Config) GetCurrentContext

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

GetCurrentContext returns the merged configuration for the current context

func (*Config) SetCluster

func (c *Config) SetCluster(name string, cluster Cluster)

SetCluster creates or updates a cluster

func (*Config) SetContext

func (c *Config) SetContext(name, cluster, user string)

SetContext creates or updates a context

func (*Config) SetUser

func (c *Config) SetUser(name string, user User)

SetUser creates or updates a user

type Context

type Context struct {
	Cluster string `yaml:"cluster"`
	User    string `yaml:"user"`
}

Context references a cluster and user

type ContextConfig

type ContextConfig struct {
	Address         string
	TLSCAPath       string
	TLSCertPath     string
	TLSKeyPath      string
	UseLegacyRoutes bool
	RulerAPIPath    string
	ID              string
	User            string
	Key             string
	AuthToken       string
}

ContextConfig represents the merged configuration from a specific context

type NamedCluster

type NamedCluster struct {
	Name    string  `yaml:"name"`
	Cluster Cluster `yaml:"cluster"`
}

NamedCluster associates a name with a cluster

type NamedContext

type NamedContext struct {
	Name    string  `yaml:"name"`
	Context Context `yaml:"context"`
}

NamedContext associates a name with a context

type NamedUser

type NamedUser struct {
	Name string `yaml:"name"`
	User User   `yaml:"user"`
}

NamedUser associates a name with user credentials

type User

type User struct {
	ID        string `yaml:"id"`
	User      string `yaml:"user,omitempty"`
	Key       string `yaml:"key,omitempty"`
	AuthToken string `yaml:"auth-token,omitempty"`
}

User contains authentication information

Jump to

Keyboard shortcuts

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