Documentation
¶
Overview ¶
Package config resolves the wazuh-cli configuration from multiple sources in priority order: CLI flags > environment variables > .env file > config file.
Index ¶
Constants ¶
View Source
const ( // DefaultConfigDir is the XDG-compliant config directory. DefaultConfigDir = ".config/wazuh" // DefaultConfigFile is the config file name inside DefaultConfigDir. DefaultConfigFile = "config.json" // DefaultTokenFile is the JWT token cache file name. DefaultTokenFile = "token" // DefaultTimeout is the default HTTP timeout in seconds. DefaultTimeout = 30 // DefaultOutput is the default output format. DefaultOutput = "json" )
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the full path to the default config file.
func DefaultTokenPath ¶
func DefaultTokenPath() string
DefaultTokenPath returns the full path to the JWT token cache.
Types ¶
type Config ¶
type Config struct {
// Connection
URL string `json:"url"`
User string `json:"user"`
Password string `json:"password"`
// TLS
Insecure bool `json:"insecure"`
CACert string `json:"ca_cert"`
ClientCert string `json:"client_cert"`
ClientKey string `json:"client_key"`
// Indexer (OpenSearch)
IndexerURL string `json:"indexer_url"`
IndexerUser string `json:"indexer_user"`
IndexerPassword string `json:"indexer_password"`
IndexerIndex string `json:"indexer_index"`
// Behavior
Timeout int `json:"timeout"`
Output string `json:"output"`
Pretty bool `json:"pretty"`
Debug bool `json:"debug"`
Quiet bool `json:"quiet"`
// Auth token (runtime only, not persisted)
RawToken string `json:"-"`
}
Config holds all wazuh-cli runtime configuration.
func Load ¶
Load builds a Config by merging all sources in priority order. configPath is the path to the JSON config file (from flag or default). overrides contains values set by CLI flags (non-zero values win).
Click to show internal directories.
Click to hide internal directories.