Documentation
¶
Overview ¶
Package settings resolves the desktop app's typed settings and on-disk locations. Desktop-owned overrides use the HIVE_DESKTOP_ prefix; XDG and shared Hive inputs remain external boundaries.
Index ¶
- Constants
- Variables
- func ActionsPath() string
- func AllocateWebhookPort(ctx context.Context) (int, error)
- func BootstrapPath() string
- func ConfigDir() string
- func DataDir() string
- func FlowsDir() string
- func LogHiveDataDir(logger zerolog.Logger, paths Paths, probeErr error)
- func MockMode() string
- func NewLogger(serviceName, path string, level zerolog.Level, extra ...io.Writer) (zerolog.Logger, func(), error)
- func ReportsDir() string
- func ResolveLogLevel() (zerolog.Level, error)
- func ResolveNotificationDelivery(value string) string
- func SaveBootstrap(b Bootstrap) error
- func SaveSettings(cfg Settings) error
- func SettingsPath() string
- func StateDir() string
- func TerminalFontSizePx(px int) int
- func ValidListenerPort(port int) bool
- type AgentWorkspacesSettings
- type Appearance
- type Bootstrap
- type DebugSettings
- type DevToolsSettings
- type DevelopmentSettings
- type EditorSettings
- type GitHubDevSettings
- type HTTPSettings
- type MenuBarFeed
- type MenuBarSettings
- type MetricsSettings
- type MockSettings
- type NotificationSettings
- type OnboardingSettings
- type Paths
- type PathsSettings
- type PerfSettings
- type PollingSettings
- type PprofSettings
- type ProfileSettings
- type ProfileTelemetrySettings
- type ResolveOptions
- type RetentionSettings
- type ReviewLabel
- type ReviewSettings
- type ServerSettings
- type Settings
- type Store
- type TelemetrySettings
- type UpdateSettings
Constants ¶
const ( EnvDataDir = "HIVE_DESKTOP_DATA_DIR" EnvHiveDataDir = config.EnvDesktopDataDir EnvConfigDir = "HIVE_DESKTOP_CONFIG_DIR" EnvFlowsDir = "HIVE_DESKTOP_FLOWS_DIR" EnvActionsPath = "HIVE_DESKTOP_ACTIONS_PATH" EnvMockMode = "HIVE_DESKTOP_DEVELOPMENT_MOCKS_MODE" EnvE2EHarness = "HIVE_DESKTOP_E2E_HARNESS" EnvHTTPEnabled = "HIVE_DESKTOP_HTTP_ENABLED" EnvHTTPPort = "HIVE_DESKTOP_HTTP_PORT" // EnvAgentWorkspacesDir is the environment name behind // agent_workspaces.dir. Named here, duplicating the settings.go struct // tag, because a struct tag cannot reference a const and startup reports // provenance by name. EnvAgentWorkspacesDir = "HIVE_DESKTOP_AGENT_WORKSPACES_DIR" EnvPerfEnabled = "HIVE_DESKTOP_DEVELOPMENT_PERF_ENABLED" )
const ( MinPollInterval = 60 * time.Second DefaultTerminalSessionAgeThresholdDays = 5 MinTerminalSessionAgeThresholdDays = 1 MaxTerminalSessionAgeThresholdDays = 365 // MaxDebugPause prevents a stale development setting from making startup // appear permanently hung while still allowing deliberate crash-window tests. MaxDebugPause = 10 * time.Minute )
const ( WebhookPortMin = 20000 WebhookPortMax = 32767 )
const ( ChannelStable = "stable" ChannelBeta = "beta" ChannelDev = "dev" DeliveryAuto = "auto" DeliverySystem = "system" DeliveryApp = "app" MockLive = "live" MockFeed = "feed" MockPipeline = "pipeline" MockOnboarding = "onboarding" MockActionSmoke = "action-smoke" )
const ( // MaxMenuBarFeeds keeps the menu bar dropdown short enough to scan; the // full inbox is the main window's job. MaxMenuBarFeeds = 3 DefaultMenuBarItemLimit = 3 MaxMenuBarItemLimit = 10 )
const ( MinTerminalFontSizePx = 8 MaxTerminalFontSizePx = 64 DefaultTerminalFontSizePx = 13 )
useTerminalFont.ts repeats these; these govern the file.
const EnvGitHubAPIBase = "HIVE_DESKTOP_DEVELOPMENT_GITHUB_API_BASE"
EnvGitHubAPIBase is the environment name behind development.github.api_base. It is named here because startup reports whether the value it is running with came from the environment or from settings.yaml.
const EnvLogLevel = "HIVE_DESKTOP_LOG_LEVEL"
const MaxActionRunRetention = 10_000
EditorSettings names the editor "Open in editor" actions launch on a directory. Command is a single word — a CLI launcher name (zed, code) or an absolute path — never a command line: the same rule agent commands follow (ADR a-workspace-declares-its-own-authority), so a flag cannot ride in through a settings string. Empty means none configured. MaxActionRunRetention bounds retention.action_runs. Each run keeps its full log, so the bound is what caps the database's size.
const MaxReviewLabels = 4
MaxReviewLabels is how many labels the comment composer offers: one per key, 1 to 4.
Variables ¶
var DefaultReviewLabels = []ReviewLabel{
{Title: "Clarify this", Icon: "circle-help"},
{Title: "Verify this", Icon: "search-check"},
{Title: "Needs tests", Icon: "flask-conical"},
{Title: "Looks good", Icon: "check"},
}
DefaultReviewLabels ship when settings.yaml names none.
Functions ¶
func ActionsPath ¶
func ActionsPath() string
func AllocateWebhookPort ¶
AllocateWebhookPort offers a stable candidate for the settings UI. Runtime automatic allocation binds port zero directly and does not use this probe.
func BootstrapPath ¶
func BootstrapPath() string
BootstrapPath is the fixed location of the bootstrap pointer file. It is deliberately anchored to the default XDG config location and is NEVER affected by a config-dir override — otherwise relocating the config dir would move the very file that records where the config dir went. It mirrors the config-dir resolution's default-location logic (XDG_CONFIG_HOME, then ~/.config) but ignores the movable desktop config-directory override.
func DataDir ¶
func DataDir() string
Package-level helpers are retained for isolated tests and e2e harnesses. Production runtime code uses the Paths snapshot injected from main.
func LogHiveDataDir ¶
LogHiveDataDir records which hive.db this run opens. probeErr is why the login shell could not be read, if it could not. A failed probe hides a HIVE_DATA_DIR that the user exports from a shell startup file, so the app falls back to its own data dir and can open a different hive.db than the run before did.
func NewLogger ¶
func NewLogger(serviceName, path string, level zerolog.Level, extra ...io.Writer) (zerolog.Logger, func(), error)
NewLogger builds the desktop root logger. An extra writer receives the encoded JSON event, the seam the telemetry log bridge attaches to.
func ReportsDir ¶
func ReportsDir() string
func ResolveLogLevel ¶
ResolveLogLevel validates the process log-level override once at startup.
func SaveBootstrap ¶
SaveBootstrap writes the pointer file, creating its parent directory. An entirely empty Bootstrap is still written (an empty file), which reads back as "no overrides".
func SaveSettings ¶
func SettingsPath ¶
func SettingsPath() string
func TerminalFontSizePx ¶
Clamps rather than rejects, so one bad field can't block startup.
func ValidListenerPort ¶
Types ¶
type AgentWorkspacesSettings ¶
type AgentWorkspacesSettings struct {
Dir string `yaml:"dir,omitempty" env:"HIVE_DESKTOP_AGENT_WORKSPACES_DIR"`
// SessionEndDelay is the grace between a chat asking to end its own
// session and the session being ended: the request arrives from inside the
// agent's own tool call, and the delay lets that call return first. Zero
// takes the shipped value.
SessionEndDelay time.Duration `yaml:"session_end_delay,omitempty" env:"HIVE_DESKTOP_AGENT_WORKSPACES_SESSION_END_DELAY"`
}
AgentWorkspacesSettings locates the agent-workspace root. Empty resolves to <ConfigDir>/workspaces; a leading `~` is expanded at read time. It is configurable because iCloud Drive is an expected destination (spec §4.4).
type Appearance ¶
type Appearance struct {
Theme string `yaml:"theme,omitempty" env:"HIVE_DESKTOP_APPEARANCE_THEME"`
// FontFamily names the family the app's chrome draws with and
// MonoFontFamily the one its monospace text draws with, neither of which
// touches a terminal — that has its own family below. Empty is the bundled
// face; a CSS generic keyword (system-ui, ui-monospace) is the platform
// stack.
FontFamily string `yaml:"font_family,omitempty" env:"HIVE_DESKTOP_APPEARANCE_FONT_FAMILY"`
MonoFontFamily string `yaml:"mono_font_family,omitempty" env:"HIVE_DESKTOP_APPEARANCE_MONO_FONT_FAMILY"`
// Pixels; 0 is the shipped default.
TerminalFontSize int `yaml:"terminal_font_size,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_SIZE"`
// TerminalFontFamily names an installed monospace family for the terminal
// only, leaving the rest of the UI alone. Empty is the bundled face.
TerminalFontFamily string `yaml:"terminal_font_family,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_FAMILY"`
// TerminalFontWeight is the CSS weight normal cells draw at, and
// TerminalFontWeightBold the weight a bold cell draws at. Zero means
// nothing persisted; the frontend owns the defaults and the valid set.
TerminalFontWeight int `yaml:"terminal_font_weight,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_WEIGHT"`
TerminalFontWeightBold int `yaml:"terminal_font_weight_bold,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_WEIGHT_BOLD"`
// TerminalLineHeight multiplies the cell height and TerminalLetterSpacing
// widens the cell by whole device pixels. Zero means nothing persisted, so
// the letter-spacing default has to stay zero — moving it would make "no
// extra tracking" unselectable.
TerminalLineHeight float64 `yaml:"terminal_line_height,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_LINE_HEIGHT"`
TerminalLetterSpacing int `yaml:"terminal_letter_spacing,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_LETTER_SPACING"`
// TerminalShowWindows lists every active session's tmux windows in the
// terminal sidebar, not just the attached session's. On by default.
TerminalShowWindows bool `yaml:"terminal_show_windows" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_WINDOWS"`
// TerminalShowStatusBar gives the attached session the same status bar a
// chat has, plus git and pull-request state. On by default.
TerminalShowStatusBar bool `yaml:"terminal_show_status_bar" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_STATUS_BAR"`
// TerminalPoolSize is how many sessions the terminal view keeps attached at
// once for instant switching (ADR terminal-attach-pool). Like the other appearance values it
// is carried verbatim and healed by the frontend: anything outside 1-6 reads
// as the default, 3.
TerminalPoolSize int `yaml:"terminal_pool_size" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_POOL_SIZE"`
// TerminalShowSessionAge marks old Hive sessions in the terminal sidebar.
// The threshold is measured in whole days from the session's creation time.
TerminalShowSessionAge bool `yaml:"terminal_show_session_age" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_SESSION_AGE"`
TerminalSessionAgeThresholdDays int `yaml:"terminal_session_age_threshold_days" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SESSION_AGE_THRESHOLD_DAYS"`
// CanvasFontSize, CanvasLineSpacing and CanvasPageWidth are preset names
// interpreted by the frontend. Empty takes the shipped defaults.
CanvasFontSize string `yaml:"canvas_font_size,omitempty" env:"HIVE_DESKTOP_APPEARANCE_CANVAS_FONT_SIZE"`
CanvasLineSpacing string `yaml:"canvas_line_spacing,omitempty" env:"HIVE_DESKTOP_APPEARANCE_CANVAS_LINE_SPACING"`
CanvasPageWidth string `yaml:"canvas_page_width,omitempty" env:"HIVE_DESKTOP_APPEARANCE_CANVAS_PAGE_WIDTH"`
}
type Bootstrap ¶
type Bootstrap struct {
DataDir string `yaml:"data_dir,omitempty"`
ConfigDir string `yaml:"config_dir,omitempty"`
}
Bootstrap holds the persisted directory overrides set from the System settings screen. Empty fields mean "use the default resolution".
DataDir is the data-dir root (the HIVE_DESKTOP_DATA_DIR equivalent) under which StateDir and the core hive.db live. ConfigDir is the desktop config root (the directory holding flows/ and actions.yml).
func LoadBootstrap ¶
LoadBootstrap reads the pointer file. A missing file is not an error: it returns a zero Bootstrap so first-run and default setups behave identically.
type DebugSettings ¶
type DevToolsSettings ¶
type DevToolsSettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_DEVTOOLS_ENABLED"`
}
DevToolsSettings makes the in-app developer tools reachable in a build that was not served by Vite (ADR developer-tools-are-reachable-in-a-shipped-build-behind-a-setting). Off in a shipped build; the dev task turns it on through launch.env.
type DevelopmentSettings ¶
type DevelopmentSettings struct {
Mocks MockSettings `yaml:"mocks"`
GitHub GitHubDevSettings `yaml:"github,omitempty"`
Vite ServerSettings `yaml:"vite" envPrefix:"HIVE_DESKTOP_DEVELOPMENT_VITE_"`
Wails ServerSettings `yaml:"wails" envPrefix:"HIVE_DESKTOP_DEVELOPMENT_WAILS_"`
Pprof PprofSettings `yaml:"pprof"`
Perf PerfSettings `yaml:"perf"`
Metrics MetricsSettings `yaml:"metrics"`
DevTools DevToolsSettings `yaml:"devtools"`
Debug DebugSettings `yaml:"debug"`
}
type EditorSettings ¶
type EditorSettings struct {
Command string `yaml:"command,omitempty" env:"HIVE_DESKTOP_EDITOR_COMMAND"`
}
type GitHubDevSettings ¶
type GitHubDevSettings struct {
APIBase string `yaml:"api_base,omitempty" env:"HIVE_DESKTOP_DEVELOPMENT_GITHUB_API_BASE"`
}
GitHubDevSettings redirects the GitHub REST/GraphQL base at cmd/desktop/devserver, the development caching proxy and event simulator (ADR devserver-github-proxy). Empty — the shipped value — means api.github.com.
Only the API base moves. The OAuth base stays github.com: a device-flow token exchange has no business passing through dev tooling, and it draws no rate-limit budget, so redirecting it would be all risk and no benefit.
type HTTPSettings ¶
type HTTPSettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_HTTP_ENABLED"`
Host string `yaml:"host" env:"HIVE_DESKTOP_HTTP_HOST"`
Port int `yaml:"port" env:"HIVE_DESKTOP_HTTP_PORT"`
}
HTTPSettings configures the local loopback HTTP server that hosts both the webhook listener and the agent API. On by default: it is loopback-only, so it is reachable only from this machine.
type MenuBarFeed ¶
type MenuBarFeed struct {
// Feed is a feed id, "<flow id>/<feed node id>".
Feed string `yaml:"feed"`
// Zero uses DefaultMenuBarItemLimit.
Limit int `yaml:"limit,omitempty"`
}
func (MenuBarFeed) ItemLimit ¶
func (f MenuBarFeed) ItemLimit() int
type MenuBarSettings ¶
type MenuBarSettings struct {
Feeds []MenuBarFeed `yaml:"feeds,omitempty"`
}
MenuBarSettings preserves feed order and permits missing feeds.
func (MenuBarSettings) Validate ¶
func (m MenuBarSettings) Validate() error
type MetricsSettings ¶
type MetricsSettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_METRICS_ENABLED"`
}
MetricsSettings gates the local Prometheus scrape endpoint, mounted on the shared HTTP server the way pprof is (ADR pprof-debug-endpoint). Independent of telemetry.enabled: the same instruments feed both readers.
type MockSettings ¶
type MockSettings struct {
Mode string `yaml:"mode" env:"HIVE_DESKTOP_DEVELOPMENT_MOCKS_MODE"`
}
type NotificationSettings ¶
type OnboardingSettings ¶
type OnboardingSettings struct {
Completed bool `yaml:"completed,omitempty"`
}
OnboardingSettings records that first run was walked to its end. It is the one thing first run cannot infer: every other step has its own signal (a usable Hive config, a connected account, a resolved notification grant), but the closing hand-off to the agent leaves nothing behind to read.
type Paths ¶
type Paths struct {
DataDir string
// HiveDataDir holds hive.db, shared with the external hive CLI. It is
// HIVE_DESKTOP_HIVE_DATA_DIR, then HIVE_DATA_DIR, then DataDir. Dev sets the
// first to the installed hive data dir so sessions created in dev land in
// the real database while desktop state stays isolated.
HiveDataDir string
StateDir string
ConfigDir string
FlowsDir string
ActionsPath string
// AgentWorkspacesDir is the agent-workspace root: agent_workspaces.dir,
// resolved and `~`-expanded, or <ConfigDir>/workspaces when unset.
AgentWorkspacesDir string
SettingsPath string
CredentialsIndexPath string
LogFile string
// ReportsDir holds the diagnostic bundles "Report a problem" writes. It is
// resolved here so the reporter and the system service's path allowlist
// cannot disagree about where they live.
ReportsDir string
DataDirOverridden bool
ConfigDirOverridden bool
}
Paths is the immutable startup snapshot of every desktop-owned location. Runtime code receives this value instead of resolving process environment repeatedly.
func ResolvePaths ¶
func ResolvePaths(b Bootstrap, opts ResolveOptions) Paths
ResolvePaths applies explicit environment overrides over bootstrap and settings values, then XDG defaults.
type PathsSettings ¶
type PathsSettings struct {
Tmux string `yaml:"tmux,omitempty" env:"HIVE_DESKTOP_PATHS_TMUX"`
}
PathsSettings locates the external binaries the app execs. Each is the escape hatch for an install discovery does not know about (ADR tmux-discovery): empty — the shipped value — searches PATH and the usual package-manager prefixes.
type PerfSettings ¶
type PerfSettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_PERF_ENABLED"`
}
PerfSettings gates the UI performance recorder, which appends spans the frontend emits to perf.jsonl under the state directory (ADR ui-performance-spans-are-recorded-to-jsonl). Off in a shipped build; the dev task turns it on through launch.env.
type PollingSettings ¶
type PprofSettings ¶
type PprofSettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_PPROF_ENABLED"`
}
PprofSettings gates the pprof endpoint; when enabled it mounts on the shared HTTP server (ADR pprof-debug-endpoint), so it has no host/port of its own.
type ProfileSettings ¶
type ProfileSettings struct {
Order []string `yaml:"order,omitempty"`
}
ProfileSettings configures the profile rail. Order names flow ids in the order they should appear; an id it omits sorts alphabetically after every id it names, so the list never has to be exhaustive and a newly created profile lands at the end rather than somewhere unspecified. An id naming no flow is ignored, so deleting a profile does not invalidate the setting.
type ProfileTelemetrySettings ¶
type ProfileTelemetrySettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_TELEMETRY_PROFILES_ENABLED"`
Endpoint string `yaml:"endpoint,omitempty" env:"HIVE_DESKTOP_TELEMETRY_PROFILES_ENDPOINT"`
User string `yaml:"user,omitempty" env:"HIVE_DESKTOP_TELEMETRY_PROFILES_USER"`
Token string `yaml:"token,omitempty" env:"HIVE_DESKTOP_TELEMETRY_PROFILES_TOKEN"`
}
ProfileTelemetrySettings configures direct Pyroscope export. Grafana Cloud Profiles has its own endpoint and basic-auth user, independent of OTLP.
type ResolveOptions ¶
type ResolveOptions struct {
// MockMode only affects the isolated onboarding flow path.
MockMode string
// AgentWorkspacesDir is settings' agent_workspaces.dir. Empty resolves to
// <ConfigDir>/workspaces; a leading `~` is expanded here.
AgentWorkspacesDir string
// Getenv reads the hive data dir variables. main passes the login shell's
// environment, where a user exports HIVE_DATA_DIR for the CLI. nil reads
// only HIVE_DESKTOP_HIVE_DATA_DIR from this process, so a test that
// isolates DataDir never reaches a HIVE_DATA_DIR in the developer's shell.
Getenv func(string) string
}
ResolveOptions carries the settings-derived inputs to path resolution. They are arguments rather than a post-hoc copy because Paths is a snapshot: every field is resolved once, by one function.
type RetentionSettings ¶ added in v0.62.0
type RetentionSettings struct {
// ActionRuns is how many finished runs of actions.yml actions to keep,
// each with its log.
ActionRuns int `yaml:"action_runs,omitempty" env:"HIVE_DESKTOP_RETENTION_ACTION_RUNS"`
}
RetentionSettings bounds the history the app keeps. Zero leaves the pipeline's own default.
func (RetentionSettings) Validate ¶ added in v0.62.0
func (r RetentionSettings) Validate() error
type ReviewLabel ¶ added in v0.65.0
ReviewLabel is one preset comment. Icon names a lucide icon from the set the frontend bundles; the frontend draws an unknown or empty one as a tag.
type ReviewSettings ¶ added in v0.65.0
type ReviewSettings struct {
// Labels are the preset comments the composer applies with keys 1 to 4,
// in order. Empty is DefaultReviewLabels.
Labels []ReviewLabel `yaml:"labels,omitempty"`
}
ReviewSettings shapes commenting on Drive documents.
func (ReviewSettings) EffectiveLabels ¶ added in v0.65.0
func (r ReviewSettings) EffectiveLabels() []ReviewLabel
EffectiveLabels is Labels, or DefaultReviewLabels when it is empty.
func (ReviewSettings) Validate ¶ added in v0.65.0
func (r ReviewSettings) Validate() error
type ServerSettings ¶
type Settings ¶
type Settings struct {
Version int `yaml:"version"`
Polling PollingSettings `yaml:"polling"`
Updates UpdateSettings `yaml:"updates"`
Notifications NotificationSettings `yaml:"notifications"`
// No omitempty: with terminal_show_windows off and nothing else set the
// struct is all-zero, and an omitted section would read back as defaults.
Appearance Appearance `yaml:"appearance"`
Profiles ProfileSettings `yaml:"profiles,omitempty"`
MenuBar MenuBarSettings `yaml:"menu_bar,omitempty"`
HTTP HTTPSettings `yaml:"http"`
Telemetry TelemetrySettings `yaml:"telemetry"`
Keybindings map[string][]string `yaml:"keybindings,omitempty"`
Paths PathsSettings `yaml:"paths,omitempty"`
Editor EditorSettings `yaml:"editor,omitempty"`
Retention RetentionSettings `yaml:"retention,omitempty"`
AgentWorkspaces AgentWorkspacesSettings `yaml:"agent_workspaces,omitempty"`
Review ReviewSettings `yaml:"review,omitempty"`
Onboarding OnboardingSettings `yaml:"onboarding,omitempty"`
Development DevelopmentSettings `yaml:"development"`
// contains filtered or unexported fields
}
Settings is the typed settings.yaml schema. Environment override provenance is process-local and is never serialized.
func DefaultSettings ¶
func DefaultSettings() Settings
func LoadPersistedSettings ¶
Package-level helpers remain for isolated tests and e2e harnesses. Runtime composition owns and injects one Store at its resolved Paths.SettingsPath.
func LoadSettings ¶
func (Settings) EnvironmentOverridden ¶
func (Settings) GitHubAPIBase ¶
GitHubAPIBase returns the canonical API base override, or "" for the client's own api.github.com default. The trailing slash is trimmed because the client concatenates paths onto this value directly.
func (Settings) UnknownKeys ¶
UnknownKeys reports the settings.yaml keys this build does not declare, one line each, or nil. The load ignores them and a save drops them.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store serializes access to one settings.yaml and keeps environment overrides process-local. All mutations go through Update so concurrent UI/background writes cannot lose each other.
type TelemetrySettings ¶
type TelemetrySettings struct {
Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_TELEMETRY_ENABLED"`
Endpoint string `yaml:"endpoint,omitempty" env:"HIVE_DESKTOP_TELEMETRY_ENDPOINT"`
InstanceID string `yaml:"instance_id,omitempty" env:"HIVE_DESKTOP_TELEMETRY_INSTANCE_ID"`
HostID string `yaml:"host_id,omitempty" env:"HIVE_DESKTOP_TELEMETRY_HOST_ID"`
Token string `yaml:"token,omitempty" env:"HIVE_DESKTOP_TELEMETRY_TOKEN"`
Profiles ProfileTelemetrySettings `yaml:"profiles,omitempty"`
}
TelemetrySettings configures OTLP export of the app's own signals. It is top-level rather than under development because it is the user's own observability, not a debug facility.
Endpoint is the signal-less OTLP base; on Grafana Cloud InstanceID is the OTLP instance id from the stack's OpenTelemetry tile, not the stack id. HostID becomes the OpenTelemetry host.id resource attribute. It is optional because it is a stable machine identifier the user must choose to disclose (ADR telemetry-carries-the-opentelemetry-host-identifier-configured-for-the-machine).
Endpoint, InstanceID, and Token may be a internal/platform/secrets reference — "env:NAME", "file:/path", "op://vault/item/field" — so one 1Password item can hold a whole destination. They differ in whether a literal is allowed: Token *requires* a reference, because a literal there is a credential in a dotfiles-managed file, while Endpoint and InstanceID name a destination and are ordinarily written out.
A reference is resolved at launch, so Validate checks Endpoint's URL shape only when it is written out. The resolved value is checked either way, by the telemetry package.