config

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config resolves KubeAura's runtime settings from three layers, in increasing order of precedence: an optional config file, the environment, and command-line flags. Every setting has a working default, so a first run needs no configuration at all.

Index

Constants

View Source
const DefaultAddr = "127.0.0.1:7654"

DefaultAddr binds loopback only. KubeAura has no authentication of its own and exposes mutating endpoints (apply, delete, exec), so reaching the wider network has to be a deliberate act — see AllowRemote.

Port 7654 rather than the usual 8080: a developer machine running a Kubernetes tool very likely already has something on 8080 (Tomcat, Spring Boot, Argo CD port-forwards, half of Docker Hub), and on macOS ports 5000 and 7000 are taken by AirPlay. 7654 is easy to type, easy to remember, and outside the crowded 3000/8000/9000 development bands. If it is busy anyway, main() steps to the next free port rather than failing.

Variables

This section is empty.

Functions

func Example

func Example() string

Example is the annotated starter config written by `kubeaura config init`.

func Path

func Path() string

Path returns the config file location KubeAura reads, whether or not it exists: $KUBEAURA_CONFIG, else $XDG_CONFIG_HOME/kubeaura/config.yaml, else ~/.config/kubeaura/config.yaml.

Types

type AIConfig

type AIConfig struct {
	Provider      string // KUBEAURA_AI_PROVIDER: anthropic|ollama|openai (empty = auto-detect)
	Model         string // KUBEAURA_AI_MODEL: model id override
	AnthropicKey  string // ANTHROPIC_API_KEY
	OllamaHost    string // OLLAMA_HOST (default http://localhost:11434 when provider=ollama)
	OpenAIBaseURL string // OPENAI_BASE_URL (e.g. http://localhost:1234/v1)
	OpenAIKey     string // OPENAI_API_KEY (optional for local servers)
}

AIConfig selects and configures the AI Assistant's model backend. KubeAura supports a hosted API (Anthropic), a local model server (Ollama), or any OpenAI-compatible endpoint — so it can run fully offline on the operator's own machine.

type Config

type Config struct {
	Addr        string // HTTP listen address
	Kubeconfig  string // path to kubeconfig; empty => in-cluster or default
	Context     string // kube context to start on; empty => current-context
	AllowRemote bool   // permit non-loopback Host headers (shared deployments)
	NoBrowser   bool   // don't auto-open a browser on start
	AI          AIConfig
	RAG         RAGConfig

	// Source records where the file layer was read from, for the startup
	// banner. Empty when no config file was found.
	Source string
}

Config holds runtime configuration for KubeAura.

func Load

func Load(f Flags) (Config, error)

Load resolves configuration from file, environment, and flags.

type Flags

type Flags struct {
	Addr        string
	Kubeconfig  string
	Context     string
	AllowRemote bool
	NoBrowser   bool
	AIProvider  string
	AIModel     string
}

Flags carries command-line overrides. Zero values mean "not set", so they fall through to the environment and file layers.

type RAGConfig

type RAGConfig struct {
	DocsEnabled bool   // KUBEAURA_DOCS_RAG_ENABLED (default true)
	DocsURL     string // KUBEAURA_DOCS_URL (unset = local docs fallback only)
	DocsPath    string // KUBEAURA_DOCS_PATH fallback path (default "docs")
	DocsTopK    int    // KUBEAURA_DOCS_TOPK (default 4)
}

RAGConfig controls docs retrieval injected into AI answers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL