Documentation
¶
Overview ¶
Package config reads and writes ~/.config/hadron/config.toml.
Index ¶
Constants ¶
const DefaultServer = "https://srv.hadronmemory.com"
DefaultServer is the hosted Hadron platform's API server (the GraphQL + OAuth host; hadronmemory.com itself is the portal).
Variables ¶
var Keys = map[string]string{
"server": "Hadron server base URL",
"app": "default App URN sent with requests (set via hadron app use)",
"memory": "default memory URN or ID (set via hadron memory set-active)",
}
Keys lists the settings hadron config get/set accepts.
Functions ¶
func AuthFile ¶
AuthFile returns the path of the fallback token file used when no OS keychain is available.
func Dir ¶
Dir returns the hadron config directory: $XDG_CONFIG_HOME/hadron, defaulting to ~/.config/hadron (gh-style, on every platform).
func WithLock ¶ added in v0.6.0
WithLock runs fn while holding an exclusive advisory lock on the config directory, serializing the whole read-modify-write across concurrent `hadron` processes (AI agents shell out in parallel). The OS releases the lock when the process exits, so a crash never leaves a stale lock. The lock file is separate from the data files it guards.
func WriteFileAtomic ¶ added in v0.6.0
WriteFileAtomic writes data to path atomically and with exactly perm, replacing any existing file. It refuses to write through a symlink, and installs a fresh file via a same-dir temp + rename — so a crash mid-write never truncates the target (the reader sees either the old or the new complete file, never an empty/partial one), and a pre-existing loose-mode file is replaced by one at perm rather than left group/world-readable (#117, #118).
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) Memory ¶ added in v0.3.0
Memory returns the default memory URN or ID, or "" for no memory context.
func (*Config) Server ¶
Server returns the configured server base URL, with the HADRON_SERVER environment variable taking precedence.