config

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config loads optional YAML settings and backend definitions for honey.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRecipesDirs added in v0.2.6

func DefaultRecipesDirs() []string

DefaultRecipesDirs returns the list of directories to check for default CUE recipes.

func ListDefaultRecipes added in v0.2.6

func ListDefaultRecipes() []string

ListDefaultRecipes returns a list of absolute paths to all .cue files found in the default recipe directories.

func ResolvePath

func ResolvePath(explicit string) (string, error)

ResolvePath returns an explicit path from --config or HONEY_CONFIG then the first existing default file, or "" if none exist.

Types

type AWSBackend

type AWSBackend struct {
	Name    string `yaml:"name" json:"name"`
	Profile string `yaml:"profile" json:"profile"`
	Region  string `yaml:"region" json:"region"`
}

AWSBackend configures one Amazon EC2 listing.

type BackendRow

type BackendRow struct {
	Kind string `json:"kind"`
	Name string `json:"name,omitempty"`
	Hint string `json:"hint,omitempty"`
}

BackendRow describes one YAML backends.* entry (for CLI / MCP listing).

type Backends

type Backends struct {
	GCP        []GCPBackend        `yaml:"gcp" json:"gcp"`
	AWS        []AWSBackend        `yaml:"aws" json:"aws"`
	Kubernetes []KubernetesBackend `yaml:"kubernetes" json:"kubernetes"`
	Consul     []ConsulBackend     `yaml:"consul" json:"consul"`
	Proxmox    []ProxmoxBackend    `yaml:"proxmox" json:"proxmox"`
}

Backends lists optional multiple instances per provider type. If a slice is nil or omitted, that provider is not defined by the file (use CLI defaults). If a slice is non-empty, one backend is created per element.

type ConsulBackend

type ConsulBackend struct {
	Name       string `yaml:"name" json:"name"`
	Addr       string `yaml:"addr" json:"addr"`
	Datacenter string `yaml:"datacenter" json:"datacenter"`
	Token      string `yaml:"token" json:"token"`
}

ConsulBackend configures one HashiCorp Consul catalog listing.

type Defaults

type Defaults struct {
	SSHUser       string `yaml:"ssh_user" json:"ssh_user"`
	CacheTTL      string `yaml:"cache_ttl" json:"cache_ttl"` // e.g. "5m", "1h"
	K8sMode       string `yaml:"k8s_mode" json:"k8s_mode"`
	K8sDebugImage string `yaml:"k8s_debug_image" json:"k8s_debug_image"`
	CacheDir      string `yaml:"cache_dir" json:"cache_dir"`
	Output        string `yaml:"output" json:"output"` // e.g. "table", "json", "tui" (default)
	Name          string `yaml:"name" json:"name"`
	NameRegex     string `yaml:"name_regex" json:"name_regex"`
}

Defaults apply when CLI flags are unset.

func (Defaults) DefaultsCacheTTL

func (d Defaults) DefaultsCacheTTL() (time.Duration, bool, error)

DefaultsCacheTTL parses Defaults.CacheTTL or returns empty and ok=false.

type File

type File struct {
	Version  int      `yaml:"version" json:"version"`
	Defaults Defaults `yaml:"defaults" json:"defaults"`
	Backends Backends `yaml:"backends" json:"backends"`
}

File is the optional honey YAML configuration.

func Load

func Load(path string) (*File, error)

Load reads and parses a YAML config file.

func ParseYAML added in v0.2.7

func ParseYAML(b []byte) (*File, error)

ParseYAML parses a honey config document from memory (used by web API PUT validation).

func (*File) HasAnyBackend

func (f *File) HasAnyBackend() bool

HasAnyBackend returns true if the file defines at least one backend entry.

func (*File) Save added in v0.2.6

func (f *File) Save(path string) error

Save serializes the config and writes it to path.

type GCPBackend

type GCPBackend struct {
	Name    string `yaml:"name" json:"name"`
	Project string `yaml:"project" json:"project"`
	Zone    string `yaml:"zone" json:"zone"`
}

GCPBackend configures one Google Cloud Compute Engine listing.

type KubernetesBackend

type KubernetesBackend struct {
	Name       string `yaml:"name" json:"name"`
	Context    string `yaml:"context" json:"context"`
	Kubeconfig string `yaml:"kubeconfig" json:"kubeconfig"`
	Mode       string `yaml:"mode" json:"mode"`
	DebugImage string `yaml:"debug_image" json:"debug_image"`
}

KubernetesBackend configures one Kubernetes nodes/pods listing.

type ProxmoxBackend added in v0.2.3

type ProxmoxBackend struct {
	Name        string `yaml:"name" json:"name"`
	URL         string `yaml:"url" json:"url"`
	User        string `yaml:"user" json:"user"`
	Password    string `yaml:"password" json:"password"`
	TokenID     string `yaml:"token_id" json:"token_id"`
	TokenSecret string `yaml:"token_secret" json:"token_secret"`
	Insecure    bool   `yaml:"insecure" json:"insecure"`
}

ProxmoxBackend configures one Proxmox VE listing.

Jump to

Keyboard shortcuts

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