Documentation
¶
Overview ¶
Package config manages ~/.flexprice/config.toml. It holds no secrets: keys live in the keyring and are referenced by KeyRef.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProfileName ¶
Punctuation-only or non-ASCII input collapses to "", which falls back to "default" rather than an unusable TOML key.
Types ¶
type Config ¶
type Overrides ¶
type Overrides struct {
Profile string
APIKey string
BaseURL string
Region string
Regions map[string]string
}
Overrides carries per-invocation flags. Regions maps a region key to its base URL and comes from the embedded spec's servers[].
type Profile ¶
type Profile struct {
Region string `toml:"region"`
BaseURL string `toml:"base_url"`
Label string `toml:"label"` // free text, set by the user; purely informational
KeyRef string `toml:"key_ref"`
}
A key is scoped to one environment, so region, base URL and key move together. No environment name or live flag, since no endpoint reveals it.
type RuntimeContext ¶
RuntimeContext is everything a command needs to build a client.
func ResolveContext ¶
func ResolveContext(cfg *Config, store Store, o Overrides) (RuntimeContext, error)
ResolveContext applies credential precedence: flag, environment variable, keyring, config file. Design doc §6.
type Store ¶
type Store interface {
Set(profile, key string) error
Get(profile string) (string, error)
Delete(profile string) error
Name() string
}
Store mirrors keyring.Store. It is redeclared here so that config does not import keyring, keeping the dependency one-directional and the tests stubbable.