Documentation
¶
Overview ¶
Package config persists the TUI's bearer token and server URL to a per-user TOML file under XDG_CONFIG_HOME.
The token is the only credential the TUI holds and is not recoverable if leaked, so the file is created with mode 0600 and the parent directory (which the OS may create) with 0700. The token is never logged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMissing = errors.New("config: file does not exist")
ErrMissing is returned by Load when the config file doesn't exist. The caller treats this as a first-run signal and prompts the user for token + server URL.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// ServerURL is the posta-server origin (e.g. "https://arne.posta.no").
// No trailing slash; the api package appends `/api/v1/...`.
ServerURL string `toml:"server_url"`
// Token is the plaintext bearer (mst_…) minted by `posta-server token
// create`. Stored verbatim because it's already opaque server-side.
Token string `toml:"token"`
// LastEventID is the most recent SSE id observed at clean shutdown,
// used as Last-Event-ID on the next start. Optional.
LastEventID string `toml:"last_event_id,omitempty"`
}
Config is the on-disk shape.
Click to show internal directories.
Click to hide internal directories.