Documentation
¶
Overview ¶
Package config resolves the CLI's runtime configuration from compiled defaults, an optional TOML config file, environment variables, and command-line flags — in that order, with later sources overriding earlier ones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTOML string
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the config directory path. The implementation is split across config_unix.go and config_windows.go via build tags so each platform's branch is exercised — and scored for coverage — only on the platform where it can actually run.
func ConfigFilePath ¶
func ConfigFilePath() string
ConfigFilePath returns the full path to the config file.
func EnsureDefaultConfig ¶
EnsureDefaultConfig creates the config directory and writes the default config.toml if it does not already exist. Returns true if the file was created.
Types ¶
type Config ¶
type Config struct {
APIURL string `koanf:"api_url"`
APIKey string `koanf:"api_key"`
Team string `koanf:"team"`
KeyringURL string `koanf:"keyring_url"`
HTTPTimeout string `koanf:"http_timeout"`
// CosignPath pins the cosign binary used during `truestamp upgrade`.
// Must be an absolute path to an executable when set; empty means
// fall back to $PATH lookup. Settable in config.toml as
// `cosign_path = "..."` or via the TRUESTAMP_COSIGN_PATH env var.
CosignPath string `koanf:"cosign_path"`
Verify VerifyConfig `koanf:"verify"`
Hash HashConfig `koanf:"hash"`
Convert ConvertConfig `koanf:"convert"`
}
Config holds the resolved configuration for the CLI.
func Load ¶
Load reads configuration in priority order: defaults → config file → env → CLI flags. configPath overrides the default config file location if non-empty. flags should be the merged flag set from the executed command (rootFlags for persistent, cmdFlags for command-specific). Only flags that were explicitly set by the user override.
type ConvertConfig ¶ added in v0.5.0
type ConvertConfig struct {
TimeZone string `koanf:"time_zone"`
}
ConvertConfig holds convert-subcommand-specific configuration.
type HashConfig ¶ added in v0.5.0
type HashConfig struct {
Algorithm string `koanf:"algorithm"`
Encoding string `koanf:"encoding"`
Style string `koanf:"style"`
}
HashConfig holds hash-subcommand-specific configuration.