config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContextNotFound = errors.New("context not found")
	ErrHostNotFound    = errors.New("host not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Version       int                 `yaml:"version"`
	ActiveContext string              `yaml:"active_context,omitempty"`
	Contexts      map[string]*Context `yaml:"contexts,omitempty"`
	Hosts         map[string]*Host    `yaml:"hosts,omitempty"`
	// contains filtered or unexported fields
}

func Load

func Load() (*Config, error)

func (*Config) Context

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

func (*Config) DeleteContext

func (c *Config) DeleteContext(name string)

func (*Config) DeleteHost

func (c *Config) DeleteHost(key string)

func (*Config) Host

func (c *Config) Host(key string) (*Host, error)

func (*Config) Path

func (c *Config) Path() string

func (*Config) Save

func (c *Config) Save() error

func (*Config) SetActiveContext

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

func (*Config) SetContext

func (c *Config) SetContext(name string, ctx *Context)

func (*Config) SetHost

func (c *Config) SetHost(key string, host *Host)

type Context

type Context struct {
	Host        string `yaml:"host"`
	StoreCode   string `yaml:"store_code,omitempty"`
	AllowWrites bool   `yaml:"allow_writes,omitempty"`
}

type Host

type Host struct {
	BaseURL            string `yaml:"base_url"`
	StoreCode          string `yaml:"store_code,omitempty"`
	Token              string `yaml:"token,omitempty"`
	AllowInsecureStore bool   `yaml:"allow_insecure_store,omitempty"`
}

func (*Host) MarshalYAML

func (h *Host) MarshalYAML() (any, error)

MarshalYAML strips the token field so credentials are never written to disk.

Jump to

Keyboard shortcuts

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