config

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Functions

func CoerceJSONNumbers

func CoerceJSONNumbers(v interface{})

CoerceJSONNumbers recursively walks a value decoded from JSON and converts float64 values that are whole numbers (e.g., 42617.0) to int64 (42617). This prevents the TOML encoder from writing "port = 42617.0" when the original config had "port = 42617".

func ConfigDir

func ConfigDir() (string, error)

func ConfigPath

func ConfigPath() (string, error)

func ExpandHome

func ExpandHome(path string) string

ExpandHome replaces a leading ~ with the user's home directory.

func ParseJSONFile

func ParseJSONFile(path string, target any) error

ParseJSONFile reads and unmarshals a JSON file into the given target.

func ParseTOMLFile

func ParseTOMLFile(path string, target any) error

ParseTOMLFile reads and unmarshals a TOML file into the given target.

func Save

func Save(cfg Config) error

Save writes the config to the config file.

func ValidateRawFormat

func ValidateRawFormat(format, content string) error

ValidateRawFormat checks that a raw config string is syntactically valid for the given format (toml, json, yaml). Returns nil on success.

func WriteConfigAtomic

func WriteConfigAtomic(path string, format string, data interface{}) error

WriteConfigAtomic writes config file atomically based on format

func WriteJSONAtomic

func WriteJSONAtomic(path string, data interface{}) error

WriteJSONAtomic writes JSON config atomically using temp file + rename

func WriteRawAtomic

func WriteRawAtomic(path string, content string) error

WriteRawAtomic writes a raw string to a file atomically. Used when the config is already in its target format (e.g., raw TOML text from the editor) and should be preserved as-is without re-encoding.

func WriteTOMLAtomic

func WriteTOMLAtomic(path string, data interface{}) error

WriteTOMLAtomic writes TOML config atomically using temp file + rename

func WriteYAMLAtomic

func WriteYAMLAtomic(path string, data interface{}) error

WriteYAMLAtomic writes YAML config atomically using temp file + rename

Types

type Config

type Config struct {
	Dashboard DashboardConfig `toml:"dashboard"`
	Discovery DiscoveryConfig `toml:"discovery"`
	Agents    []ManualAgent   `toml:"agents"`
}

func DefaultConfig

func DefaultConfig() Config

func Load

func Load() (Config, error)

type DashboardConfig

type DashboardConfig struct {
	Port        int    `toml:"port"`
	Host        string `toml:"host"`
	OpenBrowser bool   `toml:"open_browser"`
}

type DiscoveryConfig

type DiscoveryConfig struct {
	IntervalSeconds int      `toml:"interval_seconds"`
	ConfigPaths     []string `toml:"config_paths"`
}

type HiddenStore

type HiddenStore struct {
	// contains filtered or unexported fields
}

HiddenStore persists hidden session keys per agent. Stored in ~/.eyrie/hidden_sessions.json with mode 0600.

func NewHiddenStore

func NewHiddenStore() (*HiddenStore, error)

func (*HiddenStore) Hide

func (hs *HiddenStore) Hide(agentName, sessionKey string) error

func (*HiddenStore) IsHidden

func (hs *HiddenStore) IsHidden(agentName, sessionKey string) bool

func (*HiddenStore) Unhide

func (hs *HiddenStore) Unhide(agentName, sessionKey string) error

type ManualAgent

type ManualAgent struct {
	Name      string `toml:"name"`
	Framework string `toml:"framework"`
	URL       string `toml:"url"`
	Token     string `toml:"token,omitempty"`
}

type TokenStore

type TokenStore struct {
	// contains filtered or unexported fields
}

TokenStore persists bearer tokens keyed by agent name. Tokens are stored in ~/.eyrie/tokens.json with mode 0600.

func NewTokenStore

func NewTokenStore() (*TokenStore, error)

func (*TokenStore) Get

func (ts *TokenStore) Get(agentName string) string

func (*TokenStore) Set

func (ts *TokenStore) Set(agentName, token string) error

Jump to

Keyboard shortcuts

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