Skip to main content

init

Function init 

Source
pub fn init<R: Runtime>() -> TauriPlugin<R>
Expand description

Initialize the Victauri plugin with default settings (port 7373 or VICTAURI_PORT env var).

In debug builds: starts the embedded MCP server with authentication enabled (auto-generated token written to the per-user discovery directory (<root>/<pid>/token; the root is %TEMP%\victauri on Windows, and on Unix $XDG_RUNTIME_DIR/victauri, <temp>/victauri-<uid> or ~/.local/state/victauri)), injects the JS bridge, and registers all Tauri command handlers.

In release builds: returns a no-op plugin. The MCP server never starts and the linker dead-strips it, the JS bridge and the introspection tools. The crate’s dependencies are still compiled (the gate is debug_assertions, not a Cargo feature); #[inspectable] registers no command metadata in a release build.

Setting the VICTAURI_DISABLE=1 environment variable forces the no-op plugin even in a debug build — a hard kill-switch for shared environments or a release profile compiled with debug-assertions = true. When the server does activate it always logs a prominent startup banner, so it can never run silently.

For custom configuration, use VictauriBuilder::new().port(8080).build().

§Panics

Panics if the default builder configuration is invalid (this is a bug).