config

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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