Documentation
¶
Overview ¶
Package paths resolves where ovdb keeps its configuration, runtime state and data, and creates those directories owner-only — but only the ones it creates itself. Every caller receives a Dirs value instead of reading the environment, so tests inject temporary directories and run in parallel.
See spec/features/local-server-and-web-console#REQ:owner-only-state and the Locations table there. The legacy `ovdb cloud` commands keep resolving os.UserConfigDir() on their own.
Index ¶
Constants ¶
const ( EnvHome = "OVDB_HOME" EnvRuntimeDir = "OVDB_RUNTIME_DIR" // hidden: tests and diagnostics only EnvDataHome = "OVDB_DATA_HOME" )
Environment variables that override the default locations.
Variables ¶
var ErrNotPrivate = errors.New("directory is accessible to other users")
ErrNotPrivate reports an existing directory other accounts can access.
Functions ¶
func EnsurePrivateDir ¶
EnsurePrivateDir makes dir exist. Every directory it creates on the way (dir and any missing parents) is made owner-only and validated; a directory that already existed is never changed. If dir already existed and is not owner-only it returns an error wrapping ErrNotPrivate — the caller decides whether that is a warning (OVDB home) or a refusal (runtime directory).
func ExpandHome ¶ added in v0.14.0
ExpandHome is path with a leading ~ (alone, or before a separator) replaced by home, as a shell expands it: the TUI and web console have no shell to do it for them. ~user forms are left as they are.
func PrivacyFix ¶
PrivacyFix is the command that makes dir owner-only, runnable as printed in this platform's shell: PowerShell on Windows, a POSIX shell elsewhere.
func QuoteArg ¶
QuoteArg quotes s as one shell argument when it needs quoting: single quotes in both PowerShell (” escapes a quote) and POSIX shells ('\” does).
func WriteFilePrivate ¶
WriteFilePrivate atomically replaces path with data as an owner-only file: it writes a temporary file in the same directory, protects and validates it, syncs it and renames it over path.
Types ¶
type Dirs ¶
type Dirs struct {
Home string `json:"home"` // configuration: config.yaml, databases/, auth.json
Runtime string `json:"runtime"` // server.json, home.lock, secret, server.log
Data string `json:"data"` // new databases and demos
}
Dirs are the three locations one ovdb installation uses.