config

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCacheDir

func GetCacheDir() (string, error)

GetCacheDir returns the cache directory path for open-context. It creates the directory if it doesn't exist. The cache directory is located at ~/.open-context/cache on all platforms.

func GetDataDir

func GetDataDir() (string, error)

GetDataDir returns the data directory path within the cache. This is an alias for GetCacheDir for backward compatibility.

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses duration strings with support for days (d) and weeks (w) Supported formats: "24h", "7d", "1w", "30m", "0"

Types

type Config

type Config struct {
	CacheTTL Duration `yaml:"cache_ttl"`
}

Config represents the application configuration

func Load

func Load() (*Config, error)

Load loads the configuration from config.yaml

type Duration

type Duration struct {
	time.Duration
}

Duration is a custom type that supports parsing durations like "7d", "1w", etc.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler interface

Jump to

Keyboard shortcuts

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