Configuration
Last updated
This page covers where ToriiDB reads settings from: the data directory argument and the environment variables.
Configuration Surfaces
| Surface | How it is set | Required |
|---|---|---|
| Data directory | dir argument to store.New or daemon.New |
Yes |
| OpenAI API key | apiKey argument, OPENAI_API_KEY, or OS keychain |
Only for vector operations |
| Embedding dimension | TORIIDB_EMBED_DIM |
No |
There is no config file. The Go code never loads .env; the repository Makefile does include .env + export for its own targets.
Data Directory
torii, err := store.New("/var/lib/myapp/toriidb")
d, err := daemon.New("/var/lib/myapp/toriidb")
- An empty path returns an error; the directory is created when missing.
db_0throughdb_15subdirectories and their files are created lazily on first write.- For
daemon.New, the directory is resolved to an absolute, symlink-free path, and that path alone determines the socket../data,/abs/data/, and a symlink to it all share one daemon.
The process needs permission to create files, fsync them, rename them, and fsync the directory.
Environment Variables
| Variable | Default | Effect |
|---|---|---|
OPENAI_API_KEY |
none | Enables embeddings (see lookup order above) |
TORIIDB_EMBED_DIM |
256 |
Requested embedding dimension; values <= 0 fall back to 256 |
The embedding dimension is part of the cache key and must match the returned vector length. Changing it on an existing dataset leaves old vectors with a different length, and search skips them.