cliconfig

package
v0.1.0-alpha.8 Latest Latest
Warning

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

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

Documentation

Overview

Package cliconfig manages the CLI-side configuration (~/.config/zattera/config.toml): named contexts pointing at clusters, with tokens. File mode 0600 — it contains credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the config file location, honoring $ZATTERA_CONFIG.

Types

type Context

type Context struct {
	// Server is the API endpoint, e.g. "https://paas.example.com:8443".
	Server string `toml:"server"`
	Token  string `toml:"token"`
	// CACertPEM pins the cluster CA (dev mode / self-signed).
	CACertPEM string `toml:"ca_cert_pem,omitempty"`
	// Insecure skips TLS verification (dev clusters without a pinned CA).
	Insecure bool `toml:"insecure,omitempty"`
	// DefaultProject for commands that take --project.
	DefaultProject string `toml:"default_project,omitempty"`
}

Context is one cluster the CLI can talk to.

type File

type File struct {
	CurrentContext string             `toml:"current_context"`
	Contexts       map[string]Context `toml:"contexts"`
}

File is the whole CLI config.

func Load

func Load() (*File, error)

Load reads the config; a missing file yields an empty config.

func (*File) Current

func (f *File) Current() (Context, bool)

Current returns the active context.

func (*File) Save

func (f *File) Save() error

Save writes the config with 0600 permissions.

Jump to

Keyboard shortcuts

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