--- title: Configuration --- import Properties from '@theme/Properties' import Array from '@theme/Array' import Alert from '@theme/Alert' The `tauri.conf.json` is a file generated by the `tauri init` command (see here) that lives in your Tauri application source directory (src-tauri). Once generated, you may modify it at will to customize your Tauri application. # Platform-specific configuration In addition to the JSON defined on the `tauri.conf.json` file, Tauri reads a platform-specific configuration on `tauri.linux.conf.json`, `tauri.windows.conf.json` and `tauri.macos.conf.json` and merges it with the main `tauri.conf.json` configuration. # Configuration structure `tauri.conf.json` is composed of the following properties: ## `build` The target directory must contain an index.html file. `}, {property: "devPath", type: "string", description: `Can be a path to a folder (either absolute or relative to tauri.conf.json) or a URL (like a live reload server).`}, {property: "beforeDevCommand", optional: true, type: "string", description: `A command to run before starting Tauri in dev mode.`}, {property: "beforeBuildCommand", optional: true, type: "string", description: `A command to run before starting Tauri in build mode.`}, {property: "withGlobalTauri", optional: true, type: "boolean", description: "Enables the API injection to the window.__TAURI__ object. Useful if you're using Vanilla JS instead of importing the API using Rollup or Webpack. Reduces the command security since any external code can access it, so be careful with XSS attacks."} ]}/> ```js title=Example "build": { "distDir": "../dist", "devPath": "http://localhost:4000", "beforeDevCommand": "npm run dev", "beforeBuildCommand": "npm run build", "withGlobalTauri": false } ``` ## `package` ## `tauri` Any leading hyphen will be stripped, and only the first non hyphen character will be used as the short version. ` }, { property: "name", type: "string", description: `The unique argument name.` }, { property: "description", optional: true, type: "string", description: `The argument description which will be shown on the help information. Typically, this is a short (one line) description of the arg.` }, { property: "longDescription", optional: true, type: "string", description: `The argument long description which will be shown on the help information. Typically, this a more detailed (multi-line) message that describes the argument` }, { property: "takesValue", optional: true, type: "boolean", description: `Specifies that the argument takes a value at runtime. ` }, { property: "index", type: "number", optional: true, description: `The positional argument index, starting at 1. ` }, { property: "multiple", optional: true, type: "boolean", description: `Specifies that the argument may appear more than once. For flags, this results in the number of occurrences of the flag being recorded. For example -ddd or -d -d -d would count as three occurrences. For options, there is a distinct difference in multiple occurrences vs multiple values. For example, --opt val1 val2 is one occurrence, but two values. Whereas --opt val1 --opt val2 is two occurrences.` }, { property: "possibleValues", optional: true, type: "string[]", description: `Specifies a list of possible values for this argument. At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.` }, { property: "minValues", optional: true, type: "number", description: `Specifies the minimum number of values for this argument. For example, if you had a -f <file> argument where you wanted at least 2 "files" you would set minValues: 2, and this argument would be satisfied if the user provided, 2 or more values.` }, { property: "maxValues", optional: true, type: "number", description: `Specifies the maximum number of values for this argument. For example, if you had a -f <file> argument where you wanted up to 3 "files" you would set max_values: 3, and this argument would be satisfied if the user provided, 1, 2, or 3 values.` }, { property: "required", optional: true, type: "boolean", description: `Sets whether or not the argument is required by default. "required by default" means it is required, when no other conflicting rules have been evaluated conflicting rules take precedence over being required.` }, { property: "requiredUnless", optional: true, type: "string", description: `Sets an arg that overrides this arg's required setting.
i.e. this arg will be required unless this other argument is present.` }, { property: "requiredUnlessAll", optional: true, type: "string[]", description: `Sets args that override this arg's required setting.
i.e. this arg will be required unless all these other arguments are present.` }, { property: "requiredUnlessOne", optional: true, type: "string[]", description: `Sets args that override this arg's required setting.
i.e. this arg will be required unless at least one of these other arguments are present.` }, { property: "conflictsWith", optional: true, type: "string", description: `Sets a conflicting argument by name i.e. when using this argument, the following argument can't be present and vice versa.` }, { property: "conflictsWithAll", optional: true, type: "string", description: `The same as "conflictsWith" but allows specifying multiple two-way conflicts per argument.` }, { property: "requires", optional: true, type: "string", description: `Sets an argument by name that is required when this one is present.
i.e. when using this argument, the following argument must be present.` }, { property: "requiresAll", optional: true, type: "string[]", description: `Sets multiple arguments by names that are required when this one is present.
i.e. when using this argument, the following arguments must be present.` }, { property: "requiresIf", optional: true, type: "[string, string]", description: `Allows a conditional requirement with the signature [arg: string, value: string]. ` }, { property: "requiredIf", optional: true, type: "[string, string]", description: `Allows specifying that an argument is required conditionally with the signature [arg: string, value: string]. ` }, { property: "requireEquals", optional: true, type: "boolean", description: `Requires that options use the --option=val syntax.
i.e. an equals between the option and associated value.` }, ]} /> }, { property: "description", optional: true, type: "string", description: `Command description which will be shown on the help information.` }, { property: "longDescription", optional: true, type: "string", description: `Command long description which will be shown on the help information.` }, { property: "beforeHelp", optional: true, type: "string", description: `Adds additional help information to be displayed in addition to auto-generated help.
This information is displayed before the auto-generated help information.
This is often used for header information.` }, { property: "afterHelp", optional: true, type: "string", description: `Adds additional help information to be displayed in addition to auto-generated help.
This information is displayed after the auto-generated help information.
This is often used to describe how to use the arguments, or caveats to be noted.` }, { property: "subcommands", optional: true, type: "{ [name: string]: CliConfig }", description: `List of subcommands of this command.
Subcommands are effectively sub-apps, because they can contain their own arguments, subcommands, usage, etc.
They also function just like the app command, in that they get their own auto generated help and usage.` }, ]} /> }, { property: "bundle", type: "object", child: cargo build.` }, { property: "targets", optional: true, type: "string | string[]", description: `An array of the bundles you want to generate; e.g. ["deb", "app", "msi", "appimage", "dmg"] or the string 'all' to make every supported bundle. By default we bundle everything your target supports (app/dmg on mac, deb/appimage on linux, msi on windows).` }, { property: "identifier", type: "string", description: `A string that uniquely identifies your application, in reverse-DNS form (for example, "com.example.appname" or "io.github.username.project"). For OS X and iOS, this is used as the bundle's CFBundleIdentifier value; for Windows, this is hashed to create an application GUID.` }, { property: "icon", optional: true, type: "string[]", description: `A list of (relative to src-tauri) icon paths to use for your application bundle.` }, { property: "resources", optional: true, type: "string[]", description: `A list of files or directories which will be copied to the resources section of the bundle. Globs are supported.` }, { property: "externalBin", optional: true, type: "string[]", description: `A list of—either absolute or relative—paths to binaries to embed with your application. ` }, { property: "copyright", optional: true, type: "string", description: `A copyright string associated with your application.` }, { property: "category", optional: true, type: "string", description: `What kind of application this is. Should be one among the following list:
Business, DeveloperTool, Education, Entertainment, Finance, Game, ActionGame, AdventureGame, ArcadeGame, BoardGame, CardGame, CasinoGame, DiceGame, EducationalGame, FamilyGame, KidsGame, MusicGame, PuzzleGame, RacingGame, RolePlayingGame, SimulationGame, SportsGame, StrategyGame, TriviaGame, WordGame, GraphicsAndDesign, HealthcareAndFitness, Lifestyle, Medical, Music, News, Photography, Productivity, Reference, SocialNetworking, Sports, Travel, Utility, Video, Weather. ` }, { property: "shortDescription", optional: true, type: "string", description: `A short description of your application.` }, { property: "longDescription", optional: true, type: "string", description: `A longer, multi-line description of the application.` }, { property: "deb", optional: true, type: "object", child: boostrapper script.` }, { property: "files", optional: true, type: "{ [path: string]: string }", description: `The files to include on the package. See the debian guide.` }]} /> }, { property: "windows", optional: true, type: "object", child: } ]} /> }, { property: "macOS", optional: true, type: "object", child: boostrapper script.` }, { property: "exceptionDomain", optional: true, type: "string", description: `Allows your application to communicate with the outside world. ` }, { property: "signingIdentity", optional: true, type: "string", description: `Identity to use for code signing.` }, { property: "entitlements", optional: true, type: "string", description: `Path to the entitlements file.` }, ]} /> }, ]} /> }, { property: "allowlist", type: "object", child: }, { property: "window", optional: true, type: "object", child: }, { property: "shell", optional: true, type: "object", child: }, { property: "dialog", optional: true, type: "object", child: }, { property: "http", optional: true, type: "object", child: }, { property: "notification", optional: true, type: "object", child: }, { property: "globalShortcut", optional: true, type: "object", child: }, { property: "os", optional: true, type: "object", child: }, { property: "path", optional: true, type: "object", child: }, ]} /> }, { property: "windows", type: "WindowConfig[]", child: }, { property: "security", type: "object", child: This is a really important part of the configuration since it helps you ensure your WebView is secured. See more on Mozilla. ` }, ]} /> }, ]} />
Instead of launching the app directly, we configure the bundled app to run a script that tries to expose the environment variables to the app; without that you'll have trouble using system CLI apps like Node.js. ```js title=Example "tauri": { "cli": { "description": "Tauri communication example", "longDescription": null, "beforeHelp": null, "afterHelp": null, "args": [{ "short": "c", "name": "config", "takesValue": true, "description": "Config path" }, { "short": "t", "name": "theme", "takesValue": true, "description": "App theme", "possibleValues": ["light", "dark", "system"] }, { "short": "v", "name": "verbose", "multipleOccurrences": true, "description": "Verbosity level" }], "subcommands": { "update": { "description": "Updates the app", "longDescription": null, "beforeHelp": null, "afterHelp": null, "args": [{ "short": "b", "name": "background", "description": "Update in background" }], "subcommands": null } } }, "bundle": { "active": true, "targets": ["deb"], "identifier": "com.tauri.dev", "icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"], "resources": [], "externalBin": [], "copyright": "", "category": "DeveloperTool", "shortDescription": "", "longDescription": "", "deb": { "depends": [] }, "macOS": { "frameworks": [], "minimumSystemVersion": "", "exceptionDomain": "" } }, "allowlist": { "all": true }, "windows": [{ "title": "Tauri App", "width": 800, "height": 600, "resizable": true, "fullscreen": false }], "security": { "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'" } } ```