config

package
v0.13.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultPath

func GetDefaultPath() (string, error)

GetDefaultPath returns default path to Talos config.

func GetTalosDirectory

func GetTalosDirectory() (string, error)

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

Types

type Config

type Config struct {
	Context  string              `yaml:"context"`
	Contexts map[string]*Context `yaml:"contexts"`
}

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(p string) (c *Config, err error)

Open reads the config and initializes a Config struct.

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) Save

func (c *Config) Save(p string) (err error)

Save writes the config to disk.

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"`
	Crt              string   `yaml:"crt"`
	Key              string   `yaml:"key"`
}

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

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".

Jump to

Keyboard shortcuts

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