Config
The libgraft
SQLite extension can be configured using either a configuration file (graft.toml
) or environment variables.
libgraft
searches for the configuration file in the current directory or in the following standard locations:
Platform | Configuration Path | Example |
---|---|---|
Linux & macOS | $XDG_CONFIG_HOME/graft/graft.toml | /home/alice/.config/graft/graft.toml |
Windows | %APPDATA%\graft\graft.toml | C:\Users\Alice\AppData\Roaming\graft\graft.toml |
If the GRAFT_CONFIG
environment variable is set, libgraft
will use the provided path instead.
Configuration Options
Section titled “Configuration Options”The configuration file supports the following options:
data_dir
Section titled “data_dir”- Environment variable:
GRAFT_DIR
- Description: Path to the directory where Graft stores its data. Relative paths are resolved from the current working directory.
- Default:
- Linux & macOS:
$XDG_DATA_HOME/graft
or~/.local/share/graft
- Windows:
%LOCALAPPDATA%\graft
orC:\Users\%USERNAME%\AppData\Local\graft
- Linux & macOS:
metastore
Section titled “metastore”- Environment variable:
GRAFT_METASTORE
- Description: URL for the Graft MetaStore.
- Default:
http://127.0.0.1:3001
pagestore
Section titled “pagestore”- Environment variable:
GRAFT_PAGESTORE
- Description: URL for the Graft PageStore.
- Default:
http://127.0.0.1:3000
- Environment variable:
GRAFT_TOKEN
- Description: Provide an API token to use when connecting to the Graft MetaStore and PageStore.
autosync
Section titled “autosync”- Environment variable:
GRAFT_AUTOSYNC
- Description: Enables or disables background synchronization.
- Default:
true
- Values:
true
,false
- Note: Even if set to
false
, background sync can be enabled explicitly usingpragma graft_sync = true
.
client_id
Section titled “client_id”- Environment variable:
GRAFT_CLIENT_ID
- Description: Specify a unique Client ID to use. If not set, a new Client ID is randomly generated. It is strongly recommended to set this explicitly in production environments.
log_file
Section titled “log_file”- Environment variable:
GRAFT_LOG_FILE
- Description: Write a verbose log of all Graft operations to the specified log file. The verbosity can be controlled using the environment variable
RUST_LOG
. Valid verbosity levels are:error, warn, info, debug, trace
make_default
Section titled “make_default”- Environment variable:
GRAFT_MAKE_DEFAULT
- Description: When
make_default
is true, Graft will register itself as the default SQLite VFS which will cause all new connections to use Graft. This is mainly useful for integrating Graft into SQLite libraries which don’t support specifying which VFS to use.
Example Configuration File (graft.toml
)
Section titled “Example Configuration File (graft.toml)”data_dir = "/var/lib/graft"metastore = "http://metastore.example.com:3001"pagestore = "http://pagestore.example.com:3000"autosync = falseclient_id = "QiAaSzeTbNnMQFxK6jm125"