Documentation
¶
Overview ¶
Package config is STABLE — AXIS node configuration loader with strict YAML parsing. It is part of the stable operator path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns ~/.axis/nodes.yaml.
Types ¶
type AIModelConfig ¶ added in v0.9.0
type AIModelConfig struct {
Name string `json:"name" yaml:"name"`
Aliases []string `json:"aliases,omitempty" yaml:"aliases,omitempty"`
CostPer1K float64 `json:"cost_per_1k,omitempty" yaml:"cost_per_1k,omitempty"`
}
AIModelConfig describes a single model within a provider config.
type AIProviderConfig ¶ added in v0.9.0
type AIProviderConfig struct {
// Type is "local" or "cloud".
Type string `json:"type" yaml:"type"`
// Endpoint is the base URL for the provider.
// Cloud providers use a fixed default when this is unset.
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
// APIKeyEnv is the environment variable that holds the API key.
// Evaluated at runtime by internal/secrets.
APIKeyEnv string `json:"api_key_env,omitempty" yaml:"api_key_env,omitempty"`
// APIKeyFile is a path to a file whose contents are the API key.
// Used as fallback if APIKeyEnv is unset or empty.
APIKeyFile string `json:"api_key_file,omitempty" yaml:"api_key_file,omitempty"`
// Priority is 0–100 (higher = preferred when multiple providers are eligible).
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
// Enabled controls whether this provider is considered for routing.
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
// Models enumerates known models for this provider.
// Auto-detected local providers (Ollama) do not require this.
Models []AIModelConfig `json:"models,omitempty" yaml:"models,omitempty"`
}
AIProviderConfig describes a single AI inference provider in nodes.yaml. The section is optional; omitting it entirely is valid.
Example (nodes.yaml):
ai_providers:
ollama-local:
type: local
endpoint: http://localhost:11434
enabled: true
openai:
type: cloud
api_key_env: OPENAI_API_KEY
enabled: true
priority: 80
type ChatConfig ¶ added in v0.9.0
type ChatConfig struct {
// DefaultModel is the Ollama model tag to use when no --model flag is given.
// When unset, AXIS auto-selects the best available installed model.
// Example: default_model: "llama3.2:latest"
DefaultModel string `json:"default_model,omitempty" yaml:"default_model,omitempty"`
}
ChatConfig holds optional operator preferences for the chat and agent surfaces. All fields are optional; omitting the section entirely is valid.
type Config ¶
type Config struct {
Nodes []NodeConfig `json:"nodes" yaml:"nodes"`
Discovery *DiscoveryConfig `json:"discovery,omitempty" yaml:"discovery,omitempty"`
Chat *ChatConfig `json:"chat,omitempty" yaml:"chat,omitempty"`
AIProviders map[string]AIProviderConfig `json:"ai_providers,omitempty" yaml:"ai_providers,omitempty"`
Inference *InferenceConfig `json:"inference,omitempty" yaml:"inference,omitempty"`
}
Config is the top-level AXIS configuration.
func (*Config) FindNode ¶ added in v0.7.0
func (c *Config) FindNode(name string) (NodeConfig, bool)
FindNode returns the configuration for the specified node name.
func (*Config) IsMeshEnabled ¶ added in v0.10.3
IsMeshEnabled returns whether the mesh gossip layer should be started. For backward compatibility, mesh is enabled when the discovery config is absent. When discovery is explicitly configured, mesh follows Enabled.
type DiscoveryConfig ¶
type DiscoveryConfig struct {
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
UDPPort int `json:"udp_port,omitempty" yaml:"udp_port,omitempty"`
BeaconInterval int `json:"beacon_interval_sec,omitempty" yaml:"beacon_interval_sec,omitempty"`
Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
}
DiscoveryConfig describes the UDP discovery properties.
type InferenceConfig ¶ added in v0.9.0
type InferenceConfig struct {
// DefaultMode controls which providers are considered by default.
// Valid values: "local" (default), "cloud", "auto".
DefaultMode string `json:"default_mode,omitempty" yaml:"default_mode,omitempty"`
// Prefer controls the tie-breaker when multiple providers are eligible.
// Valid values: "latency" (default), "cost", "quality".
Prefer string `json:"prefer,omitempty" yaml:"prefer,omitempty"`
// MaxCostPerRequest is a hard cap in USD. Requests estimated to exceed
// this are rejected before execution. 0 means no cap.
MaxCostPerRequest float64 `json:"max_cost_per_request,omitempty" yaml:"max_cost_per_request,omitempty"`
// BudgetAlertThreshold triggers a warning when daily spend exceeds this
// amount in USD. 0 means no alert.
BudgetAlertThreshold float64 `json:"budget_alert_threshold,omitempty" yaml:"budget_alert_threshold,omitempty"`
}
InferenceConfig holds optional cluster-wide inference preferences.
Example (nodes.yaml):
inference: default_mode: local prefer: latency max_cost_per_request: 0.10
type NodeConfig ¶
type NodeConfig struct {
Name string `json:"name" yaml:"name"`
Hostname string `json:"hostname" yaml:"hostname"`
StableID string `json:"stable_id,omitempty" yaml:"stable_id,omitempty"`
SSHUser string `json:"ssh_user" yaml:"ssh_user"`
Role string `json:"role,omitempty" yaml:"role,omitempty"`
SSHPort int `json:"ssh_port,omitempty" yaml:"ssh_port,omitempty"`
TimeoutSec int `json:"timeout_sec,omitempty" yaml:"timeout_sec,omitempty"`
}
NodeConfig describes a single node in the cluster seed file. ssh_user and ssh_port are config-only — they do NOT propagate into NodeFacts. stable_id is an optional operator seed used for locality/dedupe only; it does not override observed node identity.
func (*NodeConfig) EffectiveSSHPort ¶
func (n *NodeConfig) EffectiveSSHPort() int
EffectiveSSHPort returns the SSH port, defaulting to 22.
func (*NodeConfig) EffectiveTimeout ¶
func (n *NodeConfig) EffectiveTimeout() int
EffectiveTimeout returns the timeout in seconds, defaulting to 10.