config

package
v0.1.68 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MergeModeOverride MergeMode = "override" // internal: used by view only
	MergeModeError    MergeMode = "error"    // always the user-facing mode

	// DefaultConfigFile is the canonical config path for new projects.
	DefaultConfigFile = ".ward/config.yaml"
	// DefaultKeyFile is the default age key file inside .ward/.
	DefaultKeyFile = ".ward/.key"
	// FallbackKeyFile is the fallback key file at the project root.
	FallbackKeyFile = ".ward.key"
)

Variables

This section is empty.

Functions

func FindConfigFile

func FindConfigFile() (cfgPath, originalDir string, err error)

FindConfigFile walks up the directory tree from cwd until it finds a ward config file or reaches the filesystem root. When found, it changes the working directory to the project root so that relative paths in the config remain valid. Returns the config path and the original working directory (before chdir) so callers can resolve user-supplied paths against it. Returns an error wrapping os.ErrNotExist if none are found.

func Save

func Save(path string, cfg *Config) error

Save writes cfg back to path in YAML.

Types

type Config

type Config struct {
	Encryption Encryption `yaml:"encryption,omitempty"`
	DefaultDir string     `yaml:"default_dir,omitempty"`
	Vaults     []Source   `yaml:"vaults"`
	Sources    []Source   `yaml:"sources,omitempty"` // legacy: migrated to Vaults on load
}

func Load

func Load(path string) (*Config, error)

type Encryption

type Encryption struct {
	Engine  string `yaml:"engine,omitempty"`
	KeyEnv  string `yaml:"key_env,omitempty"`
	KeyFile string `yaml:"key_file,omitempty"`
}

type MergeMode

type MergeMode string

MergeMode is used internally by the merge engine. MergeModeOverride is only used by MergeForView to produce a complete tree for display.

type Source

type Source struct {
	Name string `yaml:"name,omitempty"`
	Path string `yaml:"path"`
}

Jump to

Keyboard shortcuts

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