Documentation
¶
Overview ¶
Package config handles configuration loading, saving, and access for the nuc CLI. Configuration is stored as YAML in an XDG-compliant location.
Index ¶
Constants ¶
const ( // DefaultBaseURL is empty — Nucleus instances are per-org (e.g. nucleus-eu6.nucleussec.com). // Users must set base_url via config, --base-url flag, or NUC_BASE_URL env var. DefaultBaseURL = "" // DefaultOutputFormat is the default output format. DefaultOutputFormat = "table" )
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir returns the configuration directory path. Uses os.UserConfigDir() which respects XDG_CONFIG_HOME on Linux, ~/Library/Application Support on macOS, and %AppData% on Windows.
Types ¶
type Config ¶
type Config struct {
APIKey string `yaml:"api_key,omitempty"`
BaseURL string `yaml:"base_url,omitempty"`
DefaultProject string `yaml:"default_project,omitempty"`
OutputFormat string `yaml:"output_format,omitempty"`
}
Config represents the persisted CLI configuration.
func Load ¶
Load reads the configuration from disk. Returns a zero-value Config (not an error) if the file does not exist. Returns an error if the file exists but contains invalid YAML.
func LoadFrom ¶
LoadFrom reads the configuration from a specific path. Returns a zero-value Config (not an error) if the file does not exist.
func (*Config) BaseURLOrDefault ¶
BaseURLOrDefault returns the configured base URL or the default if not set.
func (*Config) Get ¶
Get returns the value for a configuration key. Returns an empty string for unknown keys.
func (*Config) OutputFormatOrDefault ¶
OutputFormatOrDefault returns the configured output format or the default if not set.