paths

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

CacheDir returns the OS-appropriate cache directory for dotvault.

func DefaultAPISocket added in v0.30.0

func DefaultAPISocket() string

DefaultAPISocket returns the per-user Unix domain socket path for the local API surface when api.unix.path is unset. It follows DefaultAgentSocket's resolution exactly — the runtime dir ($XDG_RUNTIME_DIR/dotvault/api.sock), which is owner-only and cleared on logout, falling back to the cache dir when XDG_RUNTIME_DIR is empty (typical on macOS).

Both sides of the borrow resolve the path through this one function: the daemon binds it, and a client on the same machine derives the same value from the same config, so neither has to be told where the other put it.

Note for service deployments: /run/user/<uid> is torn down when the user's last session ends unless lingering is enabled (`loginctl enable-linger`), which is exactly the disconnect the local socket exists to survive. The packaged systemd unit declares RuntimeDirectory=dotvault so the directory is owned by the unit; see docs/configuration/config-reference.md.

func DefaultAgentSocket added in v0.19.0

func DefaultAgentSocket() string

DefaultAgentSocket returns the per-user Unix domain socket path for the SSH agent when agent.unix.path is unset. It prefers the runtime dir ($XDG_RUNTIME_DIR/dotvault/agent.sock), which is owner-only and cleared on logout, and falls back to the cache dir dotvault already resolves when XDG_RUNTIME_DIR is empty (typical on macOS).

func ExpandHome

func ExpandHome(path string) (string, error)

ExpandHome expands a leading ~ in a path to the user's home directory.

func LogDir

func LogDir() string

LogDir returns the OS-appropriate log directory for dotvault.

func SystemConfigPath

func SystemConfigPath() string

SystemConfigPath returns the OS-appropriate path for the system config file.

func Username

func Username() (string, error)

Username returns the current OS username with any domain prefix stripped.

func ValidateLoopback

func ValidateLoopback(addr string) error

ValidateLoopback checks that addr (host:port) resolves to a loopback address.

func VaultTokenPath

func VaultTokenPath() string

VaultTokenPath returns the path to the Vault token file.

dotvault uses its own ~/.dotvault-token rather than Vault's default ~/.vault-token so a user running the upstream `vault` CLI in another context cannot clobber (or be clobbered by) the daemon's cached token.

The home directory is resolved via os.UserHomeDir (mustHomeDir), using the OS's home-directory convention, and panics if it cannot be determined. Resolving an unset home as a panic — rather than joining onto an empty string and silently yielding a CWD-relative ".dotvault-token" — keeps a token from ever landing in the working directory. The panic is part of this function's documented contract; the client facade's DefaultTokenFile recovers it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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