Documentation
¶
Index ¶
- Constants
- Variables
- func GetConfigFile(dir string) string
- func GetDefaultConfigDir() string
- func ValidConfigOptionValues(key string) []string
- func ValidConfigOptions() []string
- func ValidOutputFormats(extra ...string) []string
- func ValidPasswordStorageOptions() []string
- func ValidReadOnlyModes() []string
- func ValidateOutputFormat(format string, extra ...string) error
- type Config
- func (c *Config) EnsureConfigDir() (string, error)
- func (c *Config) GetConfigFile() string
- func (c *Config) GetStoredCredentials() (*Credentials, error)
- func (c *Config) RemoveCredentials() error
- func (c *Config) Reset() error
- func (c *Config) Set(key, value string) (string, error)
- func (c *Config) StoreCredentials(apiKey, projectID string) error
- func (c *Config) StoreOAuthCredentials(token *oauth2.Token, projectID string) error
- func (c *Config) Unset(key string) error
- type ConfigOutput
- type Credentials
- type ReadOnlyMode
Constants ¶
const ( ConfigFileName = "config.yaml" DefaultAPIURL = "https://console.cloud.tigerdata.com/public/api/v1" DefaultAnalytics = true DefaultColor = true DefaultConsoleURL = "https://console.cloud.tigerdata.com" DefaultDocsMCP = true DefaultDocsMCPURL = "https://mcp.tigerdata.com/docs?disabled_skills=ghost-database" DefaultGatewayURL = "https://console.cloud.tigerdata.com/api" DefaultMCPMaxRows = 100 DefaultOutput = "table" DefaultPasswordStorage = "keyring" DefaultReadOnly = ReadOnlyOff DefaultReleasesURL = "https://cli.tigerdata.com" DefaultVersionCheck = true // TigerCLIClientID is the OAuth client identifier registered with // savannah-gateway's /idp/external/cli/token endpoint. Used for both the // initial PKCE flow and refresh-token grants. TigerCLIClientID = "45e1b16d-e435-4049-97b2-8daad150818c" )
const ( // KeyringServiceName is the service name for all Tiger CLI keyring // entries (stored credentials here, saved service passwords in // internal/common). KeyringServiceName = "tiger-cli" )
Keyring parameters
Variables ¶
var BuildTime = "unknown"
var ErrNotLoggedIn = errors.New("not logged in")
var GitCommit = "unknown"
var Version = "dev"
These variables are set at build time via ldflags in the GoReleaser pipeline for production releases. Default values are used for local development builds.
Functions ¶
func GetConfigFile ¶
func GetDefaultConfigDir ¶
func GetDefaultConfigDir() string
func ValidConfigOptionValues ¶
ValidConfigOptionValues returns known completion values for a config key's value, or nil if the key doesn't have a fixed set of values.
func ValidConfigOptions ¶
func ValidConfigOptions() []string
ValidConfigOptions returns every settable config key, sorted: shells present completion candidates in the order they are given, so an unsorted list would reshuffle on every keystroke.
func ValidOutputFormats ¶
ValidOutputFormats returns the universally supported output formats plus any command-specific extras (`env`, `bare`).
func ValidPasswordStorageOptions ¶
func ValidPasswordStorageOptions() []string
ValidPasswordStorageOptions returns the accepted values for password_storage.
func ValidReadOnlyModes ¶ added in v0.23.0
func ValidReadOnlyModes() []string
func ValidateOutputFormat ¶
ValidateOutputFormat checks format against the universally supported formats plus any command-specific extras.
Types ¶
type Config ¶
type Config struct {
APIURL string `mapstructure:"api_url"`
Analytics bool `mapstructure:"analytics"`
Color bool `mapstructure:"color"`
ConsoleURL string `mapstructure:"console_url"`
DocsMCP bool `mapstructure:"docs_mcp"`
DocsMCPURL string `mapstructure:"docs_mcp_url"`
GatewayURL string `mapstructure:"gateway_url"`
MCPMaxRows int `mapstructure:"mcp_max_rows"`
Output string `mapstructure:"output"`
PasswordStorage string `mapstructure:"password_storage"`
ReadOnly ReadOnlyMode `mapstructure:"read_only"`
ReleasesURL string `mapstructure:"releases_url"`
ServiceID string `mapstructure:"service_id"`
VersionCheck bool `mapstructure:"version_check"`
ConfigDir string `mapstructure:"-"`
// contains filtered or unexported fields
}
Config holds the effective configuration for a single command invocation, resolved through viper's normal precedence (flag > env > file > default).
func Load ¶
Load creates a new Config instance. The provided flag set is used to resolve the effective config directory (via the config-dir flag) and to bind the CLI flags in flagBindings so they override file/env values. It may be nil for callers that have no flags to apply.
func (*Config) EnsureConfigDir ¶
EnsureConfigDir creates the config directory if it does not already exist and returns the path to the config file within it.
func (*Config) GetConfigFile ¶
func (*Config) GetStoredCredentials ¶
func (c *Config) GetStoredCredentials() (*Credentials, error)
func (*Config) RemoveCredentials ¶
RemoveCredentials removes stored credentials from keyring and file fallback
func (*Config) Set ¶
Set writes a config value and returns it as stored, which isn't always the input: read_only normalizes legacy booleans into modes. Echo the return value to the user, not the argument.
func (*Config) StoreCredentials ¶
StoreCredentials stores a PAT credential.
func (*Config) StoreOAuthCredentials ¶
StoreOAuthCredentials stores an OAuth token (access + refresh + expiry) and project ID. Use this for the PKCE login path; use StoreCredentials for PAT.
type ConfigOutput ¶
type ConfigOutput struct {
Analytics *bool `mapstructure:"analytics" json:"analytics,omitempty"`
APIURL *string `mapstructure:"api_url" json:"api_url,omitempty"`
Color *bool `mapstructure:"color" json:"color,omitempty"`
ConsoleURL *string `mapstructure:"console_url" json:"console_url,omitempty"`
DocsMCP *bool `mapstructure:"docs_mcp" json:"docs_mcp,omitempty"`
DocsMCPURL *string `mapstructure:"docs_mcp_url" json:"docs_mcp_url,omitempty"`
GatewayURL *string `mapstructure:"gateway_url" json:"gateway_url,omitempty"`
MCPMaxRows *int `mapstructure:"mcp_max_rows" json:"mcp_max_rows,omitempty"`
Output *string `mapstructure:"output" json:"output,omitempty"`
PasswordStorage *string `mapstructure:"password_storage" json:"password_storage,omitempty"`
ReadOnly *ReadOnlyMode `mapstructure:"read_only" json:"read_only,omitempty"`
ReleasesURL *string `mapstructure:"releases_url" json:"releases_url,omitempty"`
ServiceID *string `mapstructure:"service_id" json:"service_id,omitempty"`
VersionCheck *bool `mapstructure:"version_check" json:"version_check,omitempty"`
}
ConfigOutput is the shape `tiger config show` renders. Every field is a pointer so unset values can be omitted when defaults are suppressed.
func LoadForOutput ¶
func LoadForOutput(configDir string, withEnv bool, noDefaults bool) (*ConfigOutput, error)
LoadForOutput loads config values for display purposes using a fresh viper instance, independent of CLI flags. This keeps `tiger config show -o json` from reporting the flag's format as the configured `output` value.
type Credentials ¶
Credentials is the resolved form of what's in keyring/file. Exactly one of APIKey (PAT) or OAuth (PKCE) is populated.
type ReadOnlyMode ¶ added in v0.23.0
type ReadOnlyMode string
ReadOnlyMode selects which services read-only mode protects from mutating operations. The legacy booleans map onto it: true is ReadOnlyAll, false is ReadOnlyOff.
const ( ReadOnlyAll ReadOnlyMode = "all" // every service ReadOnlyProd ReadOnlyMode = "prod" // only services tagged PROD ReadOnlyOff ReadOnlyMode = "off" // none )
func (ReadOnlyMode) BlocksAll ¶ added in v0.23.0
func (m ReadOnlyMode) BlocksAll() bool
BlocksAll reports whether the mode blocks writes to every service. It's the only verdict reachable without knowing the target.