Configurate instance how to serialize and persist config data. You pass a provider to the Configurate constructor, and the plugin uses it for every read and write operation. All five provider functions return a frozen ConfigurateProvider value.
JsonProvider()
Stores config data as a human-readable, pretty-printed JSON file.
ConfigurateProvider.
YmlProvider()
Stores config data as a YAML file.
ConfigurateProvider.
TomlProvider()
Stores config data as a TOML file.
ConfigurateProvider.
BinaryProvider(opts?)
Stores config data as a compact binary file. Supports optional encryption with XChaCha20-Poly1305.
ConfigurateProvider.
Encryption key used to protect the binary file with XChaCha20-Poly1305. Omit to store data unencrypted.
Key derivation function applied to
encryptionKey before encryption. "sha256" is fast; "argon2" uses Argon2id and is significantly more resistant to brute-force attacks.BinaryProvider() without an encryptionKey stores data as compact JSON bytes with no confidentiality. Use BinaryProvider({ encryptionKey }) or the OS keyring() helper for sensitive values.SqliteProvider(opts?)
Stores config data in a SQLite database. Schema fields are materialized as typed columns. SQLite handles durability internally via WAL mode.
ConfigurateProvider.
File name of the SQLite database. The file is created in the resolved base directory.
Name of the table used to store config entries.
Rolling backups (
backup: true) have no effect with SqliteProvider. SQLite handles durability internally via WAL mode. File watching (watchExternal) is also not supported for SQLite and will throw if called.Choosing a provider
| Provider | Human-readable | Encryption | Null support | File watching |
|---|---|---|---|---|
JsonProvider | Yes | No | Yes | Yes |
YmlProvider | Yes | No | Yes | Yes |
TomlProvider | Yes | No | No (omitted) | Yes |
BinaryProvider | No | Optional | Yes | Yes |
SqliteProvider | No | No | Yes | No |
Full example
src/lib/config.ts