config

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MPL-2.0 Imports: 10 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTalosDirectory

func GetTalosDirectory() (string, error)

GetTalosDirectory returns path to Talos directory (~/.talos).

Types

type Auth

type Auth struct {
	Basic    *Basic    `yaml:"basic,omitempty"`
	SideroV1 *SideroV1 `yaml:"siderov1,omitempty"`
}

Auth may hold credentials for an authentication method such as Basic Auth.

type Basic

type Basic struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

Basic holds Basic Auth credentials.

type Config

type Config struct {
	Context  string              `yaml:"context"`
	Contexts map[string]*Context `yaml:"contexts"`
	// contains filtered or unexported fields
}

Config represents the client configuration file (talosconfig).

func FromBytes

func FromBytes(b []byte) (c *Config, err error)

FromBytes returns a config from []byte.

func FromString

func FromString(p string) (c *Config, err error)

FromString returns a config from a string.

func NewConfig

func NewConfig(contextName string, endpoints []string, caCrt []byte, client *x509.PEMEncodedCertificateAndKey) *Config

NewConfig returns the client configuration file with a single context.

func Open

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

Open reads the config and initializes a Config struct. If path is explicitly set, it will be used. If not, the default path rules will be used.

func ReadFrom

func ReadFrom(r io.Reader) (c *Config, err error)

ReadFrom reads a config from io.Reader.

func (*Config) Bytes

func (c *Config) Bytes() ([]byte, error)

Bytes gets yaml encoded config data.

func (*Config) Merge

func (c *Config) Merge(cfg *Config) []Rename

Merge in additional contexts from another Config.

Current context is overridden from passed in config.

func (*Config) Path

func (c *Config) Path() Path

Path returns the filesystem path config was read from.

func (*Config) Save

func (c *Config) Save(path string) error

Save writes the config to disk. If the path is not explicitly set, the default path rules will be used.

type Context

type Context struct {
	DeprecatedTarget string   `yaml:"target,omitempty"` // Field deprecated in favor of Endpoints
	Endpoints        []string `yaml:"endpoints"`
	Nodes            []string `yaml:"nodes,omitempty"`
	CA               string   `yaml:"ca,omitempty"`
	Crt              string   `yaml:"crt,omitempty"`
	Key              string   `yaml:"key,omitempty"`
	Auth             Auth     `yaml:"auth,omitempty"`
	Cluster          string   `yaml:"cluster,omitempty"`
}

Context represents the set of credentials required to talk to a target.

type Path

type Path struct {
	// Path is the filesystem path of the config.
	Path string
	// WriteAllowed is true if the path is allowed to be written.
	WriteAllowed bool
}

Path represents a path to a configuration file.

func GetDefaultPaths

func GetDefaultPaths() ([]Path, error)

GetDefaultPaths returns the list of config file paths in order of priority.

type Rename

type Rename struct {
	From string
	To   string
}

Rename describes context rename during merge.

func (*Rename) String

func (r *Rename) String() string

String converts to "from" -> "to".

type SideroV1

type SideroV1 struct {
	Identity string `yaml:"identity"`
}

SideroV1 holds information for SideroV1 API signature auth.

Jump to

Keyboard shortcuts

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