config

package
v1.135.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config reads/writes hosts.yml.

func New

func New(dir string) *Config

New returns a new Config rooted at dir.

func (*Config) Get

func (c *Config) Get(hostname string) (HostConfig, bool)

Get returns the HostConfig for hostname, if any.

func (*Config) Hosts

func (c *Config) Hosts() []string

Hosts returns all configured hostnames.

func (*Config) Load

func (c *Config) Load() error

Load reads hosts.yml from disk.

func (*Config) Remove

func (c *Config) Remove(hostname string)

Remove deletes hostname from the config.

func (*Config) Save

func (c *Config) Save() error

Save writes hosts.yml to disk atomically via a temp file + rename.

func (*Config) Set

func (c *Config) Set(hostname string, hc HostConfig)

Set stores hc for hostname.

type HostConfig

type HostConfig struct {
	User string `yaml:"user"`
	// AuthUser is the identity used for HTTP Basic auth (email for Atlassian
	// personal API tokens, username for App Passwords). When empty, User is
	// used as fallback. Distinct from User because the Bitbucket API returns
	// the account's username slug while Atlassian API tokens require the
	// account email address as the Basic-auth username.
	AuthUser      string `yaml:"auth_user,omitempty"`
	OAuthToken    string `yaml:"oauth_token,omitempty"`
	GitProtocol   string `yaml:"git_protocol"`
	Version       string `yaml:"version,omitempty"`
	SkipTLSVerify bool   `yaml:"skip_tls_verify,omitempty"`
	BackendType   string `yaml:"backend_type,omitempty"`
}

HostConfig is one entry in hosts.yml.

func (HostConfig) MarshalYAML added in v1.33.0

func (h HostConfig) MarshalYAML() (any, error)

MarshalYAML strips the OAuthToken before serialisation so that tokens are never written to hosts.yml. Credentials should live in the OS keyring only.

Jump to

Keyboard shortcuts

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