Documentation
¶
Overview ¶
Package config handles profile + batch-state persistence under the per-user configuration directory.
Index ¶
Constants ¶
const (
EnvConfig = "READUR_CONFIG"
)
Env variables honored when resolving paths.
const EnvProfile = "READUR_PROFILE"
EnvProfile names the profile to use, overriding the file-level default_profile. Precedence: --profile flag > READUR_PROFILE env var > file default_profile.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Paths ¶
type Paths struct {
// ConfigDir is the directory holding config.toml and the state/
// subdirectory. It is created on demand.
ConfigDir string
// ConfigFile is the TOML profile file path.
ConfigFile string
// StateDir holds per-batch resume state files.
StateDir string
}
Paths resolves the filesystem locations used by the CLI.
func Resolve ¶
Resolve returns the Paths to use, honoring an explicit override (typically --config or READUR_CONFIG) when non-empty. An override points directly at the config.toml file; its directory is taken as ConfigDir.
When no override is supplied the function uses xdg.ConfigHome (which resolves correctly on Linux, macOS, and Windows).
type Profile ¶
type Profile struct {
Name string `toml:"-"`
ServerURL string `toml:"server_url"`
Username string `toml:"username"`
Token string `toml:"token"`
TokenExpiry time.Time `toml:"token_expiry,omitempty"`
ObtainedAt time.Time `toml:"obtained_at"`
InsecureSkipVerify bool `toml:"insecure_skip_verify,omitempty"`
Password string `toml:"password,omitempty"`
}
Profile is a named, per-user record of how to reach one Readur server. Field names match the TOML keys exactly.
Password is optional: it is present only when the user opted in via `readur login --save-password`. When non-empty, the HTTP client uses it to silently refresh an expired or revoked token (see research.md §11). The field is treated as a secret exactly like Token — redacted in every subcommand's output and protected by the 0600 save path.
type Store ¶
type Store struct {
Paths Paths
}
Store is the read/write handle for the config file. It is cheap to construct and safe to use from a single goroutine.