Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultAPIURL = "https://api.cubepath.com" DefaultProfileName = "default" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
CurrentProfile string `json:"current_profile"`
Profiles map[string]*Profile `json:"profiles"`
}
func Load ¶
Load reads and parses the config file, migrating the legacy format on the fly. Returns an error if the file is missing or empty; callers that want to fall back to env vars should use ActiveProfile instead.
func LoadOrEmpty ¶ added in v1.2.0
func LoadOrEmpty() *Config
LoadOrEmpty returns the parsed config or an empty one if no file exists yet.
func (*Config) ActiveProfile ¶ added in v1.2.0
ActiveProfile returns the profile that should serve the current invocation. If CUBE_API_TOKEN is set, it synthesizes an ephemeral profile so env-based auth keeps working even without a config file.
func (*Config) ActiveProfileName ¶ added in v1.2.0
ActiveProfileName resolves which profile should be used, in order: explicit name > CUBE_PROFILE env > cfg.CurrentProfile > "default".
func (*Config) ProfileNames ¶ added in v1.2.0
Click to show internal directories.
Click to hide internal directories.