config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the directory where config files are stored.

func DefaultHost

func DefaultHost() string

DefaultHost returns "gitlab.com" or the value of GITLAB_HOST env var.

func Keys

func Keys() []string

Keys returns all valid config keys.

func SaveHosts

func SaveHosts(hosts HostsConfig) error

SaveHosts writes the hosts configuration to disk.

func TokenForHost

func TokenForHost(host string) (string, string)

TokenForHost returns the authentication token for a given host.

Types

type Config

type Config struct {
	Editor    string `json:"editor,omitempty"`
	Pager     string `json:"pager,omitempty"`
	Browser   string `json:"browser,omitempty"`
	Protocol  string `json:"protocol,omitempty"` // "https" or "ssh"
	GitRemote string `json:"git_remote,omitempty"`
}

Config holds the application configuration.

func Load

func Load() (*Config, error)

Load reads the config file from disk.

func (*Config) Get

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

Get returns a config value by key name.

func (*Config) Save

func (c *Config) Save() error

Save writes the config to disk.

func (*Config) Set

func (c *Config) Set(key, value string) error

Set updates a config value by key name.

type HostConfig

type HostConfig struct {
	Token    string `json:"token"`
	User     string `json:"user,omitempty"`
	Protocol string `json:"protocol,omitempty"`
	APIHost  string `json:"api_host,omitempty"`
}

HostConfig stores per-host authentication and settings.

type HostsConfig

type HostsConfig map[string]*HostConfig

HostsConfig maps hostnames to their configurations.

func LoadHosts

func LoadHosts() (HostsConfig, error)

LoadHosts reads the hosts configuration from disk.

Jump to

Keyboard shortcuts

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