config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultBaseURL is the production API root. Every endpoint hangs off this.
	DefaultBaseURL = "https://api.tabstack.ai/v1"
)

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the path we read from and write to. We follow the XDG base directory spec, falling back to ~/.config when XDG_CONFIG_HOME is unset.

func Save

func Save(apiKey, baseURL string) error

Save writes the API key (and base URL if non-default) to the config file with 0600 permissions. It creates the parent directory as needed.

Types

type Config

type Config struct {
	APIKey    string
	KeySource Source
	BaseURL   string
}

Config is the resolved runtime configuration for a single CLI invocation.

func Resolve

func Resolve(apiKeyFlag, baseURLFlag string) (Config, error)

Resolve builds the effective config from the three sources in priority order: explicit flag, then environment, then the config file. baseURLFlag and apiKeyFlag are the raw values from cobra (empty string means "not set").

type Source

type Source string

Source describes where a resolved API key came from. Useful for `auth status` so we can tell the user how their key is being picked up without ever printing the key itself.

const (
	SourceFlag Source = "flag"
	SourceEnv  Source = "environment"
	SourceFile Source = "config file"
	SourceNone Source = "unset"
)

Jump to

Keyboard shortcuts

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