Documentation
¶
Overview ¶
Package config manages layered CLI configuration (flags > env > config file > defaults) via an injected Viper instance and persists non-sensitive TUI user preferences (domain, username, theme, icon set, language, bookmarks). Passwords are never written to disk.
Index ¶
- func SaveSaved(cfg SavedConfig) error
- func SaveSavedTo(filePath string, cfg SavedConfig) error
- func SaveSpotlightCache(domain, username string, entries []SpotlightEntry) error
- func SaveSpotlightCacheTo(baseDir, domain, username string, entries []SpotlightEntry) error
- func SpotlightAccountKey(domain, username string) string
- func SpotlightCachePath(baseDir, domain, username string) (string, error)
- type AppConfig
- type Bookmark
- type LoaderOptions
- type SavedConfig
- type SpotlightEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveSaved ¶
func SaveSaved(cfg SavedConfig) error
SaveSaved persists non-sensitive UI preferences to the user's OS config directory using owner-only permissions (0700 directory, 0600 file).
func SaveSavedTo ¶
func SaveSavedTo(filePath string, cfg SavedConfig) error
SaveSavedTo persists non-sensitive UI preferences to filePath with 0700/0600 permissions.
func SaveSpotlightCache ¶
func SaveSpotlightCache(domain, username string, entries []SpotlightEntry) error
SaveSpotlightCache persists a per-account Spotlight metadata index with 0700/0600 permissions.
func SaveSpotlightCacheTo ¶
func SaveSpotlightCacheTo(baseDir, domain, username string, entries []SpotlightEntry) error
SaveSpotlightCacheTo persists a per-account Spotlight metadata index under baseDir.
func SpotlightAccountKey ¶
SpotlightAccountKey returns a deterministic, filesystem-safe hash uniquely identifying a (domain, username) account pair so caches never leak across accounts.
func SpotlightCachePath ¶
SpotlightCachePath resolves the per-account Spotlight index path under baseDir (or the user's OS cache directory when baseDir is empty).
Types ¶
type AppConfig ¶
type AppConfig struct {
Domain string `mapstructure:"domain"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Output string `mapstructure:"output"`
Timeout time.Duration `mapstructure:"timeout"`
AllowInsecureHTTP bool `mapstructure:"allow_insecure_http"`
DebugLog string `mapstructure:"debug_log"`
Theme string `mapstructure:"theme"`
IconSet string `mapstructure:"icon_set"`
Language string `mapstructure:"language"`
DownloadsDir string `mapstructure:"downloads_dir"`
ExportsDir string `mapstructure:"exports_dir"`
NoColor bool `mapstructure:"no_color"`
}
AppConfig holds the effective runtime configuration resolved across flags > environment variables (ISERV_*) > config file > saved UI state > defaults. Password is only ever accepted from flags or environment variables and is never written to disk.
type Bookmark ¶
type Bookmark struct {
Label string `json:"label"`
Kind string `json:"kind"` // "files" or "group"
Path string `json:"path"`
IsFile bool `json:"is_file,omitempty"`
}
Bookmark represents a pinned IServ group or directory shortcut in the TUI.
type LoaderOptions ¶
type LoaderOptions struct {
ConfigFile string
SavedState *SavedConfig
DefaultCfgDir string
}
LoaderOptions controls where config files and saved TUI state are loaded from.
type SavedConfig ¶
type SavedConfig struct {
Domain string `json:"domain"`
Username string `json:"username"`
ThemeName string `json:"theme_name,omitempty"`
IconSet string `json:"icon_set,omitempty"`
Language string `json:"language,omitempty"`
Bookmarks []Bookmark `json:"bookmarks,omitempty"`
}
SavedConfig stores non-sensitive connection defaults and TUI preferences. Passwords are never persisted.
func LoadSaved ¶
func LoadSaved() SavedConfig
LoadSaved reads saved UI preferences from the user's OS config directory.
func LoadSavedFrom ¶
func LoadSavedFrom(filePath string) SavedConfig
LoadSavedFrom reads saved UI preferences from an explicit file path.
type SpotlightEntry ¶
type SpotlightEntry struct {
Kind string `json:"kind"`
Title string `json:"title"`
Subtitle string `json:"subtitle,omitempty"`
Path string `json:"path,omitempty"`
ID string `json:"id,omitempty"`
IsDir bool `json:"is_dir,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
}
SpotlightEntry stores a lightweight metadata pointer (path, title, ID) for Spotlight omni-search. File contents, email bodies, and passwords are never stored.
func LoadSpotlightCache ¶
func LoadSpotlightCache(domain, username string) []SpotlightEntry
LoadSpotlightCache loads the persisted Spotlight metadata index for (domain, username).
func LoadSpotlightCacheFrom ¶
func LoadSpotlightCacheFrom(baseDir, domain, username string) []SpotlightEntry
LoadSpotlightCacheFrom loads a per-account Spotlight metadata index from baseDir.
func MergeSpotlightEntries ¶
func MergeSpotlightEntries(existing, incoming []SpotlightEntry, maxItems int) []SpotlightEntry
MergeSpotlightEntries upserts incoming entries into existing, preserving newest entries first and capping total size at maxItems.