config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCode

func ErrorCode(err error) string

func SetValue

func SetValue(path, key, value string) error

func UnsetValue

func UnsetValue(path, key string) error

func Value

func Value(cfg Config, key string) (string, bool)

Types

type Config

type Config struct {
	Vault    string         `mapstructure:"vault" yaml:"vault" json:"vault,omitempty"`
	Remote   RemoteConfig   `mapstructure:"remote" yaml:"remote" json:"remote"`
	Output   OutputConfig   `mapstructure:"output" yaml:"output" json:"output"`
	Editor   EditorConfig   `mapstructure:"editor" yaml:"editor" json:"editor"`
	Note     NoteConfig     `mapstructure:"note" yaml:"note" json:"note"`
	Search   SearchConfig   `mapstructure:"search" yaml:"search" json:"search"`
	Storage  StorageConfig  `mapstructure:"storage" yaml:"storage" json:"storage"`
	Themes   ThemeSet       `mapstructure:"themes" yaml:"themes" json:"themes"`
	Markdown MarkdownConfig `mapstructure:"markdown" yaml:"markdown" json:"markdown"`
}

func DefaultConfig

func DefaultConfig() Config

func (Config) Validate

func (cfg Config) Validate() error

type EditorConfig

type EditorConfig struct {
	Command string `mapstructure:"command" yaml:"command" json:"command,omitempty"`
}

type Error

type Error struct {
	Code    string
	Message string
	Err     error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type LoadOptions

type LoadOptions struct {
	VaultPath         string
	UserConfigPath    string
	ProjectConfigPath string
	ExplicitFlags     map[string]string
	Env               func(string) (string, bool)
}

type LoadResult

type LoadResult struct {
	Config   Config              `json:"config"`
	Sources  SourceSet           `json:"sources"`
	Settings []SettingProjection `json:"settings,omitempty"`
}

func Load

func Load(opts LoadOptions) (LoadResult, error)

type MarkdownConfig

type MarkdownConfig struct {
	Enabled bool   `mapstructure:"enabled" yaml:"enabled" json:"enabled"`
	Style   string `mapstructure:"style" yaml:"style" json:"style"`
	Pager   string `mapstructure:"pager" yaml:"pager" json:"pager,omitempty"`
}

type NoteConfig

type NoteConfig struct {
	Status string `mapstructure:"status" yaml:"status" json:"status,omitempty"`
	Kind   string `mapstructure:"kind" yaml:"kind" json:"kind,omitempty"`
}

type OutputConfig

type OutputConfig struct {
	Style    string         `mapstructure:"style" yaml:"style" json:"style"`
	Color    string         `mapstructure:"color" yaml:"color" json:"color"`
	Theme    string         `mapstructure:"theme" yaml:"theme" json:"theme"`
	Width    int            `mapstructure:"width" yaml:"width" json:"width"`
	Markdown MarkdownConfig `mapstructure:"markdown" yaml:"markdown" json:"markdown"`
}

type PathOptions

type PathOptions struct {
	HomeDir       string
	XDGConfigHome string
	VaultPath     string
}

type Paths

type Paths struct {
	User    string `json:"user"`
	Project string `json:"project"`
}

func ResolvePaths

func ResolvePaths(opts PathOptions) Paths

type RemoteConfig

type RemoteConfig struct {
	APIURL string `mapstructure:"api_url" yaml:"api_url" json:"api_url,omitempty"`
}

type SearchConfig

type SearchConfig struct {
	Limit      int  `mapstructure:"limit" yaml:"limit" json:"limit"`
	AllowStale bool `mapstructure:"allow_stale" yaml:"allow_stale" json:"allow_stale"`
}

type SettingProjection added in v0.1.3

type SettingProjection struct {
	Key               string   `json:"key"`
	Value             string   `json:"value"`
	Source            string   `json:"source"`
	Writable          bool     `json:"writable"`
	WriteScope        string   `json:"write_scope"`
	WritableScopes    []string `json:"writable_scopes,omitempty"`
	NextAction        string   `json:"next_action,omitempty"`
	SecretRefBoundary string   `json:"secret_ref_boundary,omitempty"`
}

type SourceSet

type SourceSet struct {
	UserConfig    string   `json:"user_config,omitempty"`
	ProjectConfig string   `json:"project_config,omitempty"`
	EnvKeys       []string `json:"env_keys,omitempty"`
	FlagKeys      []string `json:"flag_keys,omitempty"`
}

func (SourceSet) Contains

func (s SourceSet) Contains(value string) bool

type StorageConfig

type StorageConfig struct {
	Backend  string `mapstructure:"backend" yaml:"backend" json:"backend,omitempty"`
	Bucket   string `mapstructure:"bucket" yaml:"bucket" json:"bucket,omitempty"`
	Region   string `mapstructure:"region" yaml:"region" json:"region,omitempty"`
	Prefix   string `mapstructure:"prefix" yaml:"prefix" json:"prefix,omitempty"`
	Endpoint string `mapstructure:"endpoint" yaml:"endpoint" json:"endpoint,omitempty"`
	Profile  string `mapstructure:"profile" yaml:"profile" json:"profile,omitempty"`
	Token    string `mapstructure:"token" yaml:"token" json:"-"`
}

type ThemeSet

type ThemeSet struct {
	Custom map[string]string `mapstructure:"custom" yaml:"custom" json:"custom,omitempty"`
}

Jump to

Keyboard shortcuts

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