config

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultArchiveDir           = ".local/share/carn"
	DefaultClaudeSourceDir      = ".claude/projects"
	DefaultCodexSourceDir       = ".codex/sessions"
	DefaultLogDir               = ".local/state/carn"
	DefaultLogFileName          = "carn.log"
	DefaultTimestampFormat      = "2006-01-02 15:04"
	DefaultBrowserCacheSize     = 20
	DefaultDeepSearchDebounceMs = 200
	DefaultLogLevel             = "info"
	DefaultMaxSizeMB            = 10
	DefaultMaxBackups           = 3
)

Variables

This section is empty.

Functions

func DefaultTemplate

func DefaultTemplate() string

DefaultTemplate returns a TOML string with all default values commented out and explanatory comments. Suitable for writing to a new config file.

func ParseLogLevel

func ParseLogLevel(s string) (zerolog.Level, error)

ParseLogLevel converts a level name to a zerolog level constant. An empty string defaults to info level.

func ResolvePath

func ResolvePath() (string, error)

ResolvePath returns the resolved path to the config file under the user-scoped config directory.

Types

type Config

type Config struct {
	Paths   PathsConfig
	Display DisplayConfig
	Search  SearchConfig
	Logging LoggingConfig
}

Config is the fully resolved application configuration. All fields have valid values after Load returns successfully.

func Load

func Load() (Config, error)

Load resolves configuration from defaults and config file. Precedence: config file > defaults. If the config file does not exist, defaults are used silently. If the config file exists but is malformed, an error is returned.

func (Config) ArchiveConfig

func (c Config) ArchiveConfig() arch.Config

ArchiveConfig derives an archive.Config from the resolved configuration.

type DisplayConfig

type DisplayConfig struct {
	TimestampFormat  string
	BrowserCacheSize int
}

type LoggingConfig

type LoggingConfig struct {
	Level      string
	MaxSizeMB  int
	MaxBackups int
}

type PathsConfig

type PathsConfig struct {
	ArchiveDir      string
	ClaudeSourceDir string
	CodexSourceDir  string
	LogFile         string
}

type SearchConfig

type SearchConfig struct {
	DeepSearchDebounceMs int
}

type State

type State struct {
	Path   string
	Status Status
	Config Config
	Err    error
}

State describes the config file resolution result for the current user.

func LoadState

func LoadState() (State, error)

LoadState resolves the config path and returns whether the config is missing, loaded, or invalid. Invalid config falls back to defaults so the app can still boot into a blocked/fixable state.

type Status

type Status string
const (
	StatusMissing Status = "missing"
	StatusLoaded  Status = "loaded"
	StatusInvalid Status = "invalid"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL