Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName       = "bb"
	ConfigDirName = "bb"
)

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the configuration directory path (exported)

func GetClientID

func GetClientID() string

GetClientID returns the OAuth client ID. Resolution order: BB_CLIENT_ID > BB_CLIENT_ID_COMMAND > config client_id > config client_id_command.

func GetClientSecret

func GetClientSecret() string

GetClientSecret returns the OAuth client secret. Resolution order: BB_CLIENT_SECRET > BB_CLIENT_SECRET_COMMAND > config client_secret > config client_secret_command.

func GetScopes

func GetScopes() string

GetScopes returns the configured OAuth scope level or explicit list (env BB_SCOPES takes precedence over the config file). Empty means "use the default level".

func GetTokenStore

func GetTokenStore() string

GetTokenStore returns the configured token storage mode ("auto", "keyring", or "file"). BB_TOKEN_STORE overrides the config file; empty means auto (keyring plus file mirror).

func GetWorkspace

func GetWorkspace() string

GetWorkspace returns the default workspace

func HasClientCredentials

func HasClientCredentials() bool

HasClientCredentials checks if OAuth credentials are configured

func Init

func Init() error

Init initializes the configuration system

func SetClientCredentials

func SetClientCredentials(clientID, clientSecret string) error

SetClientCredentials saves OAuth client credentials to config file

func SetScopes

func SetScopes(scopes string) error

SetScopes saves the OAuth scope level/list to the config file.

func SetWorkspace

func SetWorkspace(workspace string) error

SetWorkspace saves the default workspace to config file

Types

type Config

type Config struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	// *_command values are shell commands whose stdout supplies the credential,
	// so a secret can stay in an external store (e.g. sops) instead of plaintext
	// on disk, and bb can obtain it in any context without a shell wrapper.
	ClientIDCommand     string `mapstructure:"client_id_command"`
	ClientSecretCommand string `mapstructure:"client_secret_command"`
	Workspace           string `mapstructure:"workspace"`
	OutputFormat        string `mapstructure:"output_format"`
	Scopes              string `mapstructure:"scopes"`
	// TokenStore selects OAuth persistence: "auto" (default, keyring plus file
	// mirror), "keyring" (no file), or "file" (file only).
	TokenStore string `mapstructure:"token_store"`
}

Config holds all configuration values

func Get

func Get() *Config

Get returns the current configuration

Jump to

Keyboard shortcuts

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