config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 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 the config file from and write it to.

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.

func SchemasDir added in v1.0.1

func SchemasDir() (string, error)

SchemasDir returns the default directory pre-defined schemas are pulled into (`schema pull`). It sits alongside the config file under the tabstack config home. The `--storage` flag overrides it per invocation.

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