Documentation
¶
Index ¶
- func AuthMethodForHost(host string) string
- func ClientIDForHost(host string) string
- func ConfigDir() string
- func DefaultHost() string
- func GetHostValue(host, key string) (string, error)
- func HostKeys() []string
- func Keys() []string
- func OAuthScopesForHost(host string) string
- func RedirectURIForHost(host string) string
- func SaveHosts(hosts HostsConfig) error
- func SetHostValue(host, key, value string) error
- func TokenForHost(host string) (string, string)
- type Config
- type HostConfig
- type HostsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMethodForHost ¶ added in v0.0.2
AuthMethodForHost returns the authentication method for a given host ("pat", "oauth", or "").
func ClientIDForHost ¶ added in v0.0.5
ClientIDForHost returns the stored OAuth client ID for a given host.
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 GetHostValue ¶ added in v0.0.5
GetHostValue returns a per-host config value by key.
func HostKeys ¶ added in v0.0.5
func HostKeys() []string
HostKeys returns valid per-host config keys.
func OAuthScopesForHost ¶ added in v0.0.8
OAuthScopesForHost returns the stored OAuth scopes for a given host.
func RedirectURIForHost ¶ added in v0.0.7
RedirectURIForHost returns the stored OAuth redirect URI for a given host.
func SaveHosts ¶
func SaveHosts(hosts HostsConfig) error
SaveHosts writes the hosts configuration to disk.
func SetHostValue ¶ added in v0.0.5
SetHostValue sets a per-host config value by key.
func TokenForHost ¶
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.
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"`
AuthMethod string `json:"auth_method,omitempty"` // "pat" or "oauth"
ClientID string `json:"client_id,omitempty"`
RedirectURI string `json:"redirect_uri,omitempty"`
OAuthScopes string `json:"oauth_scopes,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.