Documentation
¶
Index ¶
- func DefaultConfigPath() string
- func DeleteProfile(name string, path string) error
- func EffectiveProfileName(pc *ProfileConfig, override string) string
- func IsNoActiveProfileError(err error) bool
- func ProfileNameFromURL(serverURL string) string
- func Save(cfg *Config, path string) error
- func SaveProfile(name string, cfg *Config, path string) error
- func SaveProfiles(pc *ProfileConfig, path string) error
- func SetActiveProfile(name string, path string) error
- type Config
- type ProfileConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
func DeleteProfile ¶
DeleteProfile removes a profile from the config file.
func EffectiveProfileName ¶
func EffectiveProfileName(pc *ProfileConfig, override string) string
EffectiveProfileName resolves which profile name should be displayed or used for commands that mirror Load's profile selection behavior.
func IsNoActiveProfileError ¶
IsNoActiveProfileError reports whether err is the missing-active-profile error.
func ProfileNameFromURL ¶
ProfileNameFromURL derives a profile name from a server URL.
func SaveProfile ¶
SaveProfile writes a named profile to the config file.
func SaveProfiles ¶
func SaveProfiles(pc *ProfileConfig, path string) error
SaveProfiles writes the full profile configuration to disk.
func SetActiveProfile ¶
SetActiveProfile sets the active profile in the config file.
Types ¶
type Config ¶
type Config struct {
Server string `mapstructure:"server" yaml:"server,omitempty"`
APIKey string `mapstructure:"api_key" yaml:"api_key,omitempty"`
Username string `mapstructure:"username" yaml:"username,omitempty"`
Password string `mapstructure:"password" yaml:"password,omitempty"`
AuthMethod string `mapstructure:"auth_method" yaml:"auth_method,omitempty"` // "apikey" or "basic"
DefaultProject string `mapstructure:"default_project" yaml:"default_project,omitempty"`
OutputFormat string `mapstructure:"output_format" yaml:"output_format,omitempty"` // "table", "json", "csv"
NoColor bool `mapstructure:"no_color" yaml:"no_color,omitempty"`
}
Config holds the CLI configuration for a single profile.
type ProfileConfig ¶
type ProfileConfig struct {
ActiveProfile string `yaml:"active_profile,omitempty"`
Profiles map[string]Config `yaml:"profiles,omitempty"`
}
ProfileConfig holds the top-level configuration with multiple profiles.
func LoadProfiles ¶
func LoadProfiles(configPath string, log *debug.Logger) (*ProfileConfig, error)
LoadProfiles reads the full profile configuration from disk. It handles both legacy flat format and new profile format. If the config file does not exist, it returns an empty ProfileConfig.