new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Tauri · Plugins and security · all subjects

plugin configuration

11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Tauri configuration file purpose and usage

The Tauri configuration is used to define the source of your Web app, describe your application's metadata, configure bundles, set plugin configurations, and modify runtime behavior by configuring windows, tray icons, menus and more. It is used by the Tauri runtime and the Tauri CLI. You can define build settings (such as the command run before tauri build or tauri dev), set the name and version of your app, control the Tauri runtime, and configure plugins.

Tauri config supported formats: JSON, JSON5, TOML

The default Tauri config format is JSON. JSON5 or TOML format can be enabled by adding the config-json5 or config-toml feature flag (respectively) to the tauri and tauri-build dependencies in Cargo.toml. The structure and values are the same across all formats, but formatting should be consistent with the respective file's format. Field names are case-sensitive in all 3 formats. JSON5 and TOML support comments, and TOML can use kebab-case for config names which are more idiomatic.

How to enable JSON5 config format in Cargo.toml

To enable JSON5 format for Tauri config, add the config-json5 feature flag to both tauri-build and tauri dependencies. Example: tauri-build = { version = "2.0.0", features = [ "config-json5" ] } and tauri = { version = "2.0.0", features = [ "config-json5" ] }

Platform-specific configuration files

Tauri can read platform-specific configuration files in addition to the default configuration: tauri.linux.conf.json or Tauri.linux.toml for Linux, tauri.windows.conf.json or Tauri.windows.toml for Windows, tauri.macos.conf.json or Tauri.macos.toml for macOS, tauri.android.conf.json or Tauri.android.toml for Android, tauri.ios.conf.json or Tauri.ios.toml for iOS. The platform-specific configuration file gets merged with the main configuration object following the JSON Merge Patch (RFC 7396) specification.

How arrays are merged in platform-specific configuration

Objects are merged key by key, but arrays are replaced as a whole, including arrays nested in objects. Platform-specific array entries do not extend the base list, they take its place. This applies even when array elements are objects, such as app.windows. A platform-specific entry replaces the base entry rather than merging into it, so any field you omit falls back to its default instead of the value in your base configuration. You must repeat everything you want to keep.

Extending Tauri configuration via CLI

The Tauri CLI allows you to extend the Tauri configuration when running dev, android dev, ios dev, build, android build, ios build or bundle commands. The configuration extension can be provided by the --config argument either as a raw JSON string or as a path to a JSON file. Tauri uses the JSON Merge Patch (RFC 7396) specification to merge the provided configuration value with the originally resolved configuration object. This mechanism can be used to define multiple flavors of your application or have more flexibility when configuring your application bundles.

Extending config example: building a beta app variant

To distribute a completely isolated beta application, create a configuration file like src-tauri/tauri.beta.conf.json with separate productName and identifier. Then build using: npm run tauri build -- --config src-tauri/tauri.beta.conf.json, or with yarn: yarn tauri build --config src-tauri/tauri.beta.conf.json, or with pnpm: pnpm tauri build --config src-tauri/tauri.beta.conf.json, or with cargo: cargo tauri build --config src-tauri/tauri.beta.conf.json

tauri Cargo.toml features automatically managed

The features=[] portion of the tauri dependency in Cargo.toml is automatically managed. Running tauri dev and tauri build will automatically manage which features need to be enabled in your project based on your Tauri configuration.

Example tauri.conf.json structure with plugins

A basic tauri.conf.json structure can include: build section with devUrl and beforeDevCommand, bundle section with active flag and icon array, app section with windows array containing window title, and plugins section with plugin configurations such as updater with pubkey and endpoints.

Plugin configuration in tauri.conf.json

Plugin configuration is specified in tauri.conf.json under the plugins object, with plugin-name as the key. Example: `"plugins": { "plugin-name": { "timeout": 30 } }`. The plugin's configuration is set on the Builder and parsed at runtime.

Access plugin configuration at runtime with Config struct

Define a Config struct with #[derive(Deserialize)] to match the configuration shape. In the plugin's init function, use `Builder::<R, Config>::new("<plugin-name>")` and access configuration in the setup hook with `api.config()`. To make config optional, use `Builder::<R, Option<Config>>` instead.

Give your agent this brain

plugin configuration — Tauri · Plugins and security