Documentation
¶
Index ¶
- Constants
- func ConfigDir() (string, error)
- func GetClientID() string
- func GetClientSecret() string
- func GetScopes() string
- func GetTokenStore() string
- func GetWorkspace() string
- func HasClientCredentials() bool
- func Init() error
- func SetClientCredentials(clientID, clientSecret string) error
- func SetScopes(scopes string) error
- func SetWorkspace(workspace string) error
- type Config
Constants ¶
const ( AppName = "bb" ConfigDirName = "bb" )
Variables ¶
This section is empty.
Functions ¶
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 HasClientCredentials ¶
func HasClientCredentials() bool
HasClientCredentials checks if OAuth credentials are configured
func SetClientCredentials ¶
SetClientCredentials saves OAuth client credentials to config file
func SetWorkspace ¶
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