Documentation
¶
Overview ¶
Package config provides the single source of truth for arc CLI and server settings. Settings are stored in TOML format at ~/.arc/config.toml.
Index ¶
Constants ¶
const DefaultServerPort = 7432
DefaultServerPort is the built-in default port for the arc server.
Variables ¶
var ValidChannels = []string{"stable", "rc", "nightly"}
ValidChannels lists the allowed values for updates.channel.
Functions ¶
func LegacyJSONPath ¶
func LegacyJSONPath() string
LegacyJSONPath returns ~/.arc/cli-config.json (the pre-TOML location).
func RequiresRestart ¶
func RequiresRestart() []string
RequiresRestart returns dotted keys whose changes don't take effect in a running arc-server until the server restarts. Used by the API + web UI to surface a "requires restart" warning.
Types ¶
type CLIConfig ¶
type CLIConfig struct {
Server string `toml:"server" json:"server"`
}
CLIConfig holds settings the arc CLI uses to reach the server.
type Config ¶
type Config struct {
CLI CLIConfig `toml:"cli" json:"cli"`
Server ServerConfig `toml:"server" json:"server"`
Updates UpdatesConfig `toml:"updates" json:"updates"`
}
Config is the full arc configuration document.
func Load ¶
Load reads the TOML config from path. If path is missing but the legacy cli-config.json exists in the same directory, Load migrates JSON → TOML, renames the legacy file to *.bak, and prints a one-line stderr notice. If neither exists, Load writes Default() to path and returns it. Missing fields are filled from Default(). The returned Config is validated; an invalid file returns a non-nil error.
type ServerConfig ¶
type ServerConfig struct {
Port int `toml:"port" json:"port"`
DBPath string `toml:"db_path" json:"db_path"`
}
ServerConfig holds settings the arc server uses for its own runtime.
func (ServerConfig) ResolvedDBPath ¶
func (s ServerConfig) ResolvedDBPath() string
ResolvedDBPath returns DBPath with a leading ~ expanded to the user's home directory. Use this when you need a real filesystem path (e.g., opening the SQLite database). Do NOT call this before writing DBPath back to TOML — the raw value (which may contain ~) should be stored as-is for portability.
type ShareConfig ¶
type ShareConfig struct {
}
ShareConfig holds defaults for `arc share` and the web share UI.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps an atomically-swappable *Config. The arc server holds one Store and reads through Load() so that a future Reload() can hot-swap without mutating consumers. Callers must treat the returned *Config as read-only.
type UpdatesConfig ¶
type UpdatesConfig struct {
Channel string `toml:"channel" json:"channel"`
}
UpdatesConfig holds update-channel settings for `arc self`.
type ValidationError ¶
ValidationError maps dotted-key to error message.
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Error returns a sorted, semicolon-separated list of all validation failures.