Skip to main content
The Builder struct lets you configure tauri-plugin-configurate before it is registered with Tauri. Use it to set a custom file-size cap, restrict which BaseDirectory values IPC payloads may reference, or open that restriction entirely. If you do not need any customization, the init() shorthand registers the plugin with all defaults.

Initializing the plugin

You have two ways to register the plugin with tauri::Builder. Simple initialization — uses every default setting and is the most common choice:
tauri::Builder::default()
    .plugin(tauri_plugin_configurate::init())
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
Custom initialization — chain builder methods before calling .build() to override specific defaults:
tauri::Builder::default()
    .plugin(
        tauri_plugin_configurate::Builder::default()
            .max_read_bytes(32 * 1024 * 1024)
            .build()
    )
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
init() is exactly equivalent to Builder::default().build(). Prefer init() when you have nothing to customize — it is shorter and signals intent clearly.

Builder methods

Builder::default() / Builder::new()

Creates a new builder pre-loaded with the following defaults:
SettingDefault value
max_read_bytes16_777_216 (16 MiB)
allowed_base_dirsApp-scoped directories only (see Default allowed directories)
Both functions are interchangeable — Builder::new() delegates to Builder::default().
let plugin = tauri_plugin_configurate::Builder::default().build();
// equivalent to:
let plugin = tauri_plugin_configurate::Builder::new().build();

.max_read_bytes(bytes: usize) -> Self

bytes
usize
required
Maximum number of bytes the plugin will read from a single config file or import content string. Must be greater than zero.
Sets the upper bound on how many bytes the plugin reads when loading a config file or processing an import payload. Any read that would exceed this limit is rejected with an error before the full content is consumed, protecting your application from unexpectedly large files. The default is 16 MiB (16_777_216 bytes). Raise this if your app legitimately works with large configs; lower it for tighter memory constraints.
.max_read_bytes(32 * 1024 * 1024) // 32 MiB
max_read_bytes must be greater than 0. Passing 0 causes the plugin to panic during initialization with the message "maxReadBytes must be greater than 0".
tauri.conf.json takes precedence. When plugins.configurate.maxReadBytes is set in your Tauri config file, that value overrides whatever you pass to .max_read_bytes() at runtime. See tauri.conf.json configuration below.

.allowed_base_directories(dirs) -> Self

dirs
impl IntoIterator<Item = BaseDirectory>
required
An iterable of tauri::path::BaseDirectory variants that IPC payloads are permitted to use. Replaces the default allowlist entirely.
Replaces the default BaseDirectory allowlist with your own set. Any IPC request that references a directory not in this list is rejected by the plugin before touching the filesystem. Use this method when your application genuinely needs access to a directory outside the app-scoped defaults — for example, Document for user-facing export paths — but you still want to keep the allowlist explicit rather than unrestricted.
.allowed_base_directories([
    tauri::path::BaseDirectory::AppConfig,
    tauri::path::BaseDirectory::Document,
])

.allow_any_base_directory() -> Self

Disables BaseDirectory validation entirely. After calling this method, IPC payloads may reference any BaseDirectory variant without restriction.
.allow_any_base_directory()
Use this only when your use case genuinely requires arbitrary directory access — for example, a developer tool that must navigate the user’s home tree. For production apps that manage their own config files, the default restricted policy is strongly recommended.

.build() -> TauriPlugin

Consumes the builder and returns the configured TauriPlugin instance ready to pass to .plugin(). Call this as the final step of every builder chain.
let plugin = tauri_plugin_configurate::Builder::default()
    .max_read_bytes(8 * 1024 * 1024)
    .build();

tauri::Builder::default()
    .plugin(plugin)
    .run(tauri::generate_context!())
    .expect("error while running tauri application");

Default allowed directories

When you use Builder::default(), Builder::new(), or init(), the plugin restricts IPC baseDir values to the following app-scoped and system temporary directories:
BaseDirectory variantTypical resolved path
AppConfigPlatform app config folder
AppDataPlatform app data folder
AppLocalDataPlatform app local-data folder
AppCachePlatform app cache folder
AppLogPlatform app log folder
ResourceTauri resource directory (bundled assets)
TempSystem temporary directory
Any IPC request that references a directory outside this list — such as Home, Desktop, or Download — is rejected with an error describing which directories are permitted. Use .allowed_base_directories() or .allow_any_base_directory() on the builder to expand access.

tauri.conf.json configuration

You can set maxReadBytes in your Tauri project’s tauri.conf.json file under the plugins.configurate key:
{
  "plugins": {
    "configurate": {
      "maxReadBytes": 33554432
    }
  }
}
When this key is present, its value overrides any value you pass to .max_read_bytes() in the Rust builder. This makes it straightforward to tune the limit for different build profiles (for example, a CI environment config that keeps the limit low) without changing source code. The BaseDirectory allowlist is not configurable through tauri.conf.json — use the builder methods for that.