config

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FleetKey added in v0.10.0

func FleetKey(appDir string) (string, error)

FleetKey returns the stored fleet bearer token, mirroring MasterKey's keychain-preferred / file-fallback storage. It tries the OS keychain first, then a 0600 <appDir>/.fleet_api_key file (migrating that file's value into the keychain when found). An empty string with a nil error means "not stored yet" so the caller can generate a fresh token or migrate a legacy config.json value and persist it via SetFleetKey.

func MasterKey

func MasterKey(appDir string) ([]byte, error)

func SetFleetKey added in v0.10.0

func SetFleetKey(appDir, value string) error

SetFleetKey persists the fleet bearer token keychain-first, falling back to a 0600 <appDir>/.fleet_api_key file when the keychain is unavailable (headless Linux / CI), exactly like MasterKey's storage tail.

Types

type AppConfig

type AppConfig struct {
	FirstRunComplete       bool   `json:"firstRunComplete"`
	DisplayCurrency        string `json:"displayCurrency"`
	RuntimeProvider        string `json:"runtimeProvider"`
	AutoUpdate             bool   `json:"autoUpdate"`
	HostnamePrefix         string `json:"hostnamePrefix"`
	CollectIntervalMinutes int    `json:"collectIntervalMinutes"`
	RetentionDays          int    `json:"retentionDays"`
	Timezone               string `json:"timezone"`
	// FleetAPIKey is the legacy plaintext location for the fleet bearer token. It is
	// no longer persisted here — the token lives in the OS keychain with a 0600 file
	// fallback via FleetKey/SetFleetKey. The field is retained with omitempty only so
	// an older config.json still unmarshals and ensureFleetAPIKey can migrate its
	// value into the keychain and then blank it from disk.
	FleetAPIKey      string `json:"fleetApiKey,omitempty"`
	FleetBindAddress string `json:"fleetBindAddress"`
	FleetPort        int    `json:"fleetPort"`
	// MetricsEnabled turns on the opt-in Prometheus /metrics endpoint on the fleet
	// server. It defaults to false (disabled) — the bool zero value, so applyDefaults
	// needs no change. Enabling it exposes earnings, health and fleet stats on the
	// fleet bind address (loopback by default) with no authentication, matching the
	// Prometheus scraping convention.
	MetricsEnabled bool `json:"metricsEnabled"`
	// WorkerURLPolicy selects how the SSRF worker-URL validator (internal/fleetnet)
	// classifies a remote worker endpoint before the desktop makes an authenticated
	// request to it. One of "strict" (only WorkerAllowedHosts), "private" (RFC1918 +
	// Tailscale CGNAT 100.64.0.0/10 + IPv6 ULA fc00::/7 + the allowlist — the sensible
	// homelab default), or "public" (any non-loopback/link-local/metadata/unspecified
	// address). Defaults to "private" via applyDefaults.
	WorkerURLPolicy string `json:"workerUrlPolicy"`
	// WorkerAllowedHosts is an explicit allowlist of worker hosts/IPs. It is the sole
	// allow-source in "strict" mode and is always honored in the other modes. Entries
	// may be an exact hostname, a "*.suffix" DNS suffix (e.g. Tailscale MagicDNS
	// "*.mango-alpha.ts.net"), a CIDR, or a literal IP. Defaults to empty (nil).
	WorkerAllowedHosts []string `json:"workerAllowedHosts"`
	// WorkerAllowMetadata, when false (the default, the bool zero value), makes the
	// cloud instance-metadata endpoints (169.254.169.254, fd00:ec2::254,
	// metadata.google.internal) ALWAYS blocked regardless of policy or allowlist.
	// Setting it true is the only way to reach a metadata address and should be rare.
	WorkerAllowMetadata bool `json:"workerAllowMetadata"`
}

type Manager

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

func NewManager

func NewManager() (*Manager, error)

func (*Manager) AppDir

func (m *Manager) AppDir() string

func (*Manager) Config

func (m *Manager) Config() AppConfig

func (*Manager) DataDir

func (m *Manager) DataDir() string

func (*Manager) Save

func (m *Manager) Save(cfg AppConfig) error

Jump to

Keyboard shortcuts

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