Documentation
¶
Overview ¶
Package config manages named contexts (kubectl-style) persisted to ~/.vibexp/config.yaml. It also resolves the effective runtime settings using the precedence: flag > env > active context.
Index ¶
Constants ¶
const ( EnvContext = "VIBEXP_CONTEXT" EnvBaseURL = "VIBEXP_BASE_URL" EnvTeam = "VIBEXP_TEAM" EnvProject = "VIBEXP_PROJECT" EnvFormat = "VIBEXP_FORMAT" )
Environment variable names honored during resolution.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct {
Name string `koanf:"name" yaml:"name"`
BaseURL string `koanf:"base_url" yaml:"base_url"`
DefaultTeam string `koanf:"team" yaml:"team,omitempty"`
DefaultProject string `koanf:"project" yaml:"project,omitempty"`
}
Context is a single named target: a base URL plus optional default team and project. Credentials are NOT stored here — they live in credentials.json.
type File ¶
type File struct {
CurrentContext string `koanf:"current_context" yaml:"current_context"`
Contexts []Context `koanf:"contexts" yaml:"contexts"`
}
File is the on-disk config document.
type Overrides ¶
type Overrides struct {
Context string
BaseURL string
Team string
Project string
Format string
Timeout time.Duration
}
Overrides carries values sourced from command-line flags. Empty strings mean "not set" and fall through to the next precedence level.
type Runtime ¶
type Runtime struct {
// ContextName is the name of the active context (may be empty if none).
ContextName string
BaseURL string
Team string
Project string
Timeout time.Duration
// Format is the resolved output format (flag > env; empty = auto). JQ and
// IsTTY are populated by the CLI layer (flag-only / terminal detection).
Format string
JQ string
IsTTY bool
// Slugs looks up the UUID behind a team or project slug, which REST paths
// require. The root installs it (api.NewSlugResolver) when it builds the
// runtime, so api.Team/api.Project resolve lazily whatever order a command
// builds its client and path in: only a command that is team- or
// project-scoped pays for the lookup. When nil, a UUID still passes through
// but a slug fails closed (exit 1).
Slugs SlugResolver
}
Runtime is the fully-resolved effective configuration handed to commands.
type SlugResolver ¶
type SlugResolver interface {
TeamID(slug string) (string, error)
ProjectID(teamID, slug string) (string, error)
}
SlugResolver maps a team or project slug to its UUID.
type Store ¶
type Store struct {
Path string
}
Store reads and writes the config file at Path.
func DefaultStore ¶
DefaultStore returns a Store rooted at the default config path.