config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides configuration and path management for OmniVault.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.5.0

type Config struct {
	// AutoLockTimeout is the duration after which the vault auto-locks.
	// Use time.Duration format (e.g., "15m", "1h").
	AutoLockTimeout string `json:"auto_lock_timeout,omitempty"`

	// DefaultFormat is the default output format (text, json, yaml, shell).
	DefaultFormat string `json:"default_format,omitempty"`

	// DefaultTags are applied to all new secrets.
	DefaultTags map[string]string `json:"default_tags,omitempty"`

	// ExpiryWarningDays is the number of days before expiry to show warnings.
	ExpiryWarningDays int `json:"expiry_warning_days,omitempty"`
}

Config represents the user configuration for OmniVault.

func DefaultConfig added in v0.5.0

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

func LoadConfig added in v0.5.0

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from the config file. Returns default config if the file doesn't exist.

func LoadConfigFromFile added in v0.5.0

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

LoadConfigFromFile loads the configuration from a specific file.

func (*Config) GetAutoLockDuration added in v0.5.0

func (c *Config) GetAutoLockDuration() time.Duration

GetAutoLockDuration parses and returns the auto-lock timeout duration.

func (*Config) GetExpiryWarningDays added in v0.5.0

func (c *Config) GetExpiryWarningDays() int

GetExpiryWarningDays returns the number of days for expiry warnings.

func (*Config) Save added in v0.5.0

func (c *Config) Save() error

Save writes the configuration to the config file.

func (*Config) SaveToFile added in v0.5.0

func (c *Config) SaveToFile(path string) error

SaveToFile writes the configuration to a specific file.

type Paths

type Paths struct {
	// ConfigDir is the base configuration directory.
	ConfigDir string

	// ConfigFile is the user configuration file.
	ConfigFile string

	// VaultFile is the encrypted vault data file.
	VaultFile string

	// MetaFile is the vault metadata file (salt, params).
	MetaFile string

	// SocketPath is the Unix socket path for the daemon (Unix only).
	SocketPath string

	// TCPAddr is the TCP address for the daemon (Windows only).
	TCPAddr string

	// PIDFile is the daemon PID file.
	PIDFile string

	// LogFile is the daemon log file.
	LogFile string
}

Paths contains all file system paths used by OmniVault.

func GetPaths

func GetPaths() *Paths

GetPaths returns the appropriate paths for the current platform.

func (*Paths) CleanupSocket

func (p *Paths) CleanupSocket() error

CleanupSocket removes the socket file if it exists.

func (*Paths) EnsureConfigDir

func (p *Paths) EnsureConfigDir() error

EnsureConfigDir creates the configuration directory if it doesn't exist.

func (*Paths) VaultExists

func (p *Paths) VaultExists() bool

VaultExists returns true if the vault file exists.

Jump to

Keyboard shortcuts

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