Documentation
¶
Overview ¶
Package config owns the CLI's persistent configuration. The fields are intentionally empty during foundation bring-up. Concrete settings will land alongside the first feature that needs them. Load/Save are kept so callers (App, future commands) don't move when fields return.
The config directory follows the conventions used by other SafeDep tools (pmg, gryph): a SafeDep-namespaced subdir under the user's platform config location, with explicit env overrides and respect for XDG layouts on every platform.
When log or cache dirs land later, they will need their own resolvers: logs belong under %LOCALAPPDATA% on Windows (per pmg #82), and cache belongs under os.UserCacheDir() on every platform (per gryph). This package owns config only today.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataDir ¶
DataDir returns the directory where the CLI stores durable state (sqlite DB, future caches that survive across runs). Internal resolution order:
- SAFEDEP_DATA_DIR joined with this tool's name.
- XDG_DATA_HOME joined with "safedep/cli".
- $HOME/.local/share/safedep/cli when that path already exists.
- Platform default joined with "safedep/cli": Linux: ~/.local/share, macOS: ~/Library/Application Support, Windows: %LOCALAPPDATA%.
Types ¶
type Config ¶
type Config struct {
Storage StorageConfig `mapstructure:"storage"`
}
Config is the deserialised CLI config file. Add fields here. Load/Save pick them up automatically via viper's mapstructure binding.
type StorageConfig ¶
type StorageConfig struct {
// Retention overrides keyed by storage primitive name as a plain
// string (matches the TOML/env shape on disk). Callers building a
// storage.CleanupPolicy convert these into storage.PrimitiveName
// at the boundary; unknown keys are ignored. Zero duration means
// "no time-based cleanup, only TTL."
Retention map[string]time.Duration `mapstructure:"retention"`
}
StorageConfig captures persistent-state configuration. Zero value plus DefaultStorageConfig produces a usable config.
func DefaultStorageConfig ¶
func DefaultStorageConfig() StorageConfig
DefaultStorageConfig returns the baseline storage configuration. No per-primitive defaults are set here today: descriptor-level defaults inside internal/storage are authoritative until users opt into an override.