config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 6 Imported by: 1 module, 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

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GitHub    ProviderConfig `toml:"github"`
	GitLab    ProviderConfig `toml:"gitlab"`
	Bitbucket ProviderConfig `toml:"bitbucket"`
	// Hosts configures individual git hosts, keyed by the host name as it
	// appears in the remote URL (which may be an SSH alias).
	Hosts map[string]HostConfig `toml:"hosts"`
}

func Load

func Load() (*Config, error)

Load reads config from standard locations. Returns empty config if no file found. Returns error if $GR_CONFIG is set but file doesn't exist.

func (*Config) Host

func (c *Config) Host(name string) (*HostConfig, bool)

Host returns the configuration of a host (case-insensitive), if any.

type HostConfig

type HostConfig struct {
	ProviderConfig
	// Provider is github, gitlab or bitbucket; setting it skips probing.
	Provider string `toml:"provider"`
	// WebURL is the web root, e.g. "https://example.com/gitlab"
	// (default: https://<host>, or the origin of APIURL).
	WebURL string `toml:"web_url"`
	// APIURL is the REST API root, e.g. "https://example.com/gitlab/api/v4"
	// (default: the provider's API below WebURL).
	APIURL string `toml:"api_url"`
}

HostConfig describes one git host. Its credentials, if set, take precedence over the environment and the provider sections.

type ProviderConfig

type ProviderConfig struct {
	Token            string `toml:"token"` // literal or "${ENV_VAR}"
	CredentialHelper string `toml:"credential_helper"`
	Username         string `toml:"username"`
}

Jump to

Keyboard shortcuts

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