config_definition.rs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. #![allow(clippy::field_reassign_with_default)]
  5. use schemars::JsonSchema;
  6. use serde::{Deserialize, Serialize};
  7. use serde_json::Value as JsonValue;
  8. use serde_with::skip_serializing_none;
  9. use std::collections::HashMap;
  10. #[derive(Debug, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  11. #[serde(untagged)]
  12. pub enum BundleTarget {
  13. All(Vec<String>),
  14. One(String),
  15. }
  16. #[skip_serializing_none]
  17. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  18. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  19. pub struct DebConfig {
  20. pub depends: Option<Vec<String>>,
  21. #[serde(default)]
  22. pub use_bootstrapper: bool,
  23. }
  24. #[skip_serializing_none]
  25. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  26. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  27. pub struct MacConfig {
  28. pub frameworks: Option<Vec<String>>,
  29. pub minimum_system_version: Option<String>,
  30. pub exception_domain: Option<String>,
  31. pub license: Option<String>,
  32. #[serde(default)]
  33. pub use_bootstrapper: bool,
  34. pub signing_identity: Option<String>,
  35. pub entitlements: Option<String>,
  36. }
  37. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  38. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  39. pub struct WindowsConfig {
  40. pub digest_algorithm: Option<String>,
  41. pub certificate_thumbprint: Option<String>,
  42. pub timestamp_url: Option<String>,
  43. }
  44. #[skip_serializing_none]
  45. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  46. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  47. pub struct PackageConfig {
  48. /// App name. Automatically converted to kebab-case on Linux.
  49. pub product_name: Option<String>,
  50. /// App version.
  51. pub version: Option<String>,
  52. }
  53. #[skip_serializing_none]
  54. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  55. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  56. pub struct BundleConfig {
  57. /// Whether we should build your app with tauri-bundler or plain `cargo build`
  58. pub active: bool,
  59. /// The bundle targets, currently supports ["deb", "app", "msi", "appimage", "dmg"] or "all"
  60. pub targets: Option<BundleTarget>,
  61. /// The app's identifier
  62. pub identifier: Option<String>,
  63. /// The app's icons
  64. pub icon: Option<Vec<String>>,
  65. /// App resources to bundle.
  66. /// Each resource is a path to a file or directory.
  67. /// Glob patterns are supported.
  68. pub resources: Option<Vec<String>>,
  69. pub copyright: Option<String>,
  70. pub category: Option<String>,
  71. pub short_description: Option<String>,
  72. pub long_description: Option<String>,
  73. #[serde(default)]
  74. pub deb: DebConfig,
  75. #[serde(rename = "macOS", default)]
  76. pub macos: MacConfig,
  77. pub external_bin: Option<Vec<String>>,
  78. #[serde(default)]
  79. pub windows: WindowsConfig,
  80. }
  81. /// A CLI argument definition
  82. #[skip_serializing_none]
  83. #[derive(Debug, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  84. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  85. pub struct CliArg {
  86. /// The short version of the argument, without the preceding -.
  87. ///
  88. /// NOTE: Any leading - characters will be stripped, and only the first non - character will be used as the short version.
  89. pub short: Option<char>,
  90. /// The unique argument name
  91. pub name: String,
  92. /// The argument description which will be shown on the help information.
  93. /// Typically, this is a short (one line) description of the arg.
  94. pub description: Option<String>,
  95. /// The argument long description which will be shown on the help information.
  96. /// Typically this a more detailed (multi-line) message that describes the argument.
  97. pub long_description: Option<String>,
  98. /// Specifies that the argument takes a value at run time.
  99. ///
  100. /// NOTE: values for arguments may be specified in any of the following methods
  101. /// - Using a space such as -o value or --option value
  102. /// - Using an equals and no space such as -o=value or --option=value
  103. /// - Use a short and no space such as -ovalue
  104. pub takes_value: Option<bool>,
  105. /// Specifies that the argument may appear more than once.
  106. ///
  107. /// - For flags, this results in the number of occurrences of the flag being recorded.
  108. /// For example -ddd or -d -d -d would count as three occurrences.
  109. /// - For options there is a distinct difference in multiple occurrences vs multiple values.
  110. /// For example, --opt val1 val2 is one occurrence, but two values. Whereas --opt val1 --opt val2 is two occurrences.
  111. pub multiple: Option<bool>,
  112. /// specifies that the argument may appear more than once.
  113. pub multiple_occurrences: Option<bool>,
  114. ///
  115. pub number_of_values: Option<u64>,
  116. /// Specifies a list of possible values for this argument.
  117. /// At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.
  118. pub possible_values: Option<Vec<String>>,
  119. /// Specifies the minimum number of values for this argument.
  120. /// For example, if you had a -f <file> argument where you wanted at least 2 'files',
  121. /// you would set `minValues: 2`, and this argument would be satisfied if the user provided, 2 or more values.
  122. pub min_values: Option<u64>,
  123. /// Specifies the maximum number of values are for this argument.
  124. /// For example, if you had a -f <file> argument where you wanted up to 3 'files',
  125. /// you would set .max_values(3), and this argument would be satisfied if the user provided, 1, 2, or 3 values.
  126. pub max_values: Option<u64>,
  127. /// Sets whether or not the argument is required by default.
  128. ///
  129. /// - Required by default means it is required, when no other conflicting rules have been evaluated
  130. /// - Conflicting rules take precedence over being required.
  131. pub required: Option<bool>,
  132. /// Sets an arg that override this arg's required setting
  133. /// i.e. this arg will be required unless this other argument is present.
  134. pub required_unless_present: Option<String>,
  135. /// Sets args that override this arg's required setting
  136. /// i.e. this arg will be required unless all these other arguments are present.
  137. pub required_unless_present_all: Option<Vec<String>>,
  138. /// Sets args that override this arg's required setting
  139. /// i.e. this arg will be required unless at least one of these other arguments are present.
  140. pub required_unless_present_any: Option<Vec<String>>,
  141. /// Sets a conflicting argument by name
  142. /// i.e. when using this argument, the following argument can't be present and vice versa.
  143. pub conflicts_with: Option<String>,
  144. /// The same as conflictsWith but allows specifying multiple two-way conflicts per argument.
  145. pub conflicts_with_all: Option<Vec<String>>,
  146. /// Tets an argument by name that is required when this one is present
  147. /// i.e. when using this argument, the following argument must be present.
  148. pub requires: Option<String>,
  149. /// Sts multiple arguments by names that are required when this one is present
  150. /// i.e. when using this argument, the following arguments must be present.
  151. pub requires_all: Option<Vec<String>>,
  152. /// Allows a conditional requirement with the signature [arg, value]
  153. /// the requirement will only become valid if `arg`'s value equals `${value}`.
  154. pub requires_if: Option<Vec<String>>,
  155. /// Allows specifying that an argument is required conditionally with the signature [arg, value]
  156. /// the requirement will only become valid if the `arg`'s value equals `${value}`.
  157. pub required_if_eq: Option<Vec<String>>,
  158. /// Requires that options use the --option=val syntax
  159. /// i.e. an equals between the option and associated value.
  160. pub require_equals: Option<bool>,
  161. /// The positional argument index, starting at 1.
  162. ///
  163. /// The index refers to position according to other positional argument.
  164. /// It does not define position in the argument list as a whole. When utilized with multiple=true,
  165. /// only the last positional argument may be defined as multiple (i.e. the one with the highest index).
  166. pub index: Option<u64>,
  167. }
  168. /// describes a CLI configuration
  169. #[skip_serializing_none]
  170. #[derive(Debug, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  171. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  172. pub struct CliConfig {
  173. /// command description which will be shown on the help information
  174. description: Option<String>,
  175. /// command long description which will be shown on the help information
  176. long_description: Option<String>,
  177. /// adds additional help information to be displayed in addition to auto-generated help
  178. /// this information is displayed before the auto-generated help information.
  179. /// this is often used for header information
  180. before_help: Option<String>,
  181. /// adds additional help information to be displayed in addition to auto-generated help
  182. /// this information is displayed after the auto-generated help information
  183. /// this is often used to describe how to use the arguments, or caveats to be noted.
  184. after_help: Option<String>,
  185. /// list of args for the command
  186. args: Option<Vec<CliArg>>,
  187. /// list of subcommands of this command.
  188. ///
  189. /// subcommands are effectively sub-apps, because they can contain their own arguments, subcommands, usage, etc.
  190. /// they also function just like the app command, in that they get their own auto generated help and usage
  191. subcommands: Option<HashMap<String, CliConfig>>,
  192. }
  193. #[derive(Debug, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  194. #[serde(untagged)]
  195. pub enum Port {
  196. /// Port with a numeric value.
  197. Value(u16),
  198. /// Random port.
  199. Random,
  200. }
  201. /// The window configuration object.
  202. #[skip_serializing_none]
  203. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  204. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  205. pub struct WindowConfig {
  206. /// The window identifier.
  207. pub label: Option<String>,
  208. /// The window webview URL.
  209. pub url: Option<String>,
  210. /// The horizontal position of the window's top left corner
  211. pub x: Option<f64>,
  212. /// The vertical position of the window's top left corner
  213. pub y: Option<f64>,
  214. /// The window width.
  215. pub width: Option<f64>,
  216. /// The window height.
  217. pub height: Option<f64>,
  218. /// The min window width.
  219. pub min_width: Option<f64>,
  220. /// The min window height.
  221. pub min_height: Option<f64>,
  222. /// The max window width.
  223. pub max_width: Option<f64>,
  224. /// The max window height.
  225. pub max_height: Option<f64>,
  226. /// Whether the window is resizable or not.
  227. #[serde(default)]
  228. pub resizable: bool,
  229. /// The window title.
  230. pub title: Option<String>,
  231. /// Whether the window starts as fullscreen or not.
  232. #[serde(default)]
  233. pub fullscreen: bool,
  234. /// Whether the window is transparent or not.
  235. #[serde(default)]
  236. pub transparent: bool,
  237. /// Whether the window is maximized or not.
  238. #[serde(default)]
  239. pub maximized: bool,
  240. /// Whether the window is visible or not.
  241. #[serde(default = "default_visible")]
  242. pub visible: bool,
  243. /// Whether the window should have borders and bars.
  244. #[serde(default = "default_decorations")]
  245. pub decorations: bool,
  246. /// Whether the window should always be on top of other windows.
  247. #[serde(default)]
  248. pub always_on_top: bool,
  249. }
  250. fn default_visible() -> bool {
  251. true
  252. }
  253. fn default_decorations() -> bool {
  254. true
  255. }
  256. #[skip_serializing_none]
  257. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  258. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  259. pub struct SecurityConfig {
  260. pub csp: Option<String>,
  261. }
  262. trait Allowlist {
  263. fn to_features(&self) -> Vec<&str>;
  264. }
  265. macro_rules! check_feature {
  266. ($self:ident, $features:ident, $flag:ident, $feature_name: expr) => {
  267. if $self.$flag {
  268. $features.push($feature_name)
  269. }
  270. };
  271. }
  272. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  273. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  274. struct FsAllowlistConfig {
  275. #[serde(default)]
  276. all: bool,
  277. #[serde(default)]
  278. read_text_file: bool,
  279. #[serde(default)]
  280. read_binary_file: bool,
  281. #[serde(default)]
  282. write_file: bool,
  283. #[serde(default)]
  284. write_binary_file: bool,
  285. #[serde(default)]
  286. read_dir: bool,
  287. #[serde(default)]
  288. copy_file: bool,
  289. #[serde(default)]
  290. create_dir: bool,
  291. #[serde(default)]
  292. remove_dir: bool,
  293. #[serde(default)]
  294. remove_file: bool,
  295. #[serde(default)]
  296. rename_file: bool,
  297. #[serde(default)]
  298. path: bool,
  299. }
  300. impl Allowlist for FsAllowlistConfig {
  301. fn to_features(&self) -> Vec<&str> {
  302. if self.all {
  303. vec!["fs-all"]
  304. } else {
  305. let mut features = Vec::new();
  306. check_feature!(self, features, read_text_file, "fs-read-text-file");
  307. check_feature!(self, features, read_binary_file, "fs-read-binary-file");
  308. check_feature!(self, features, write_file, "fs-write-file");
  309. check_feature!(self, features, write_binary_file, "fs-write-binary-file");
  310. check_feature!(self, features, read_dir, "fs-read-dir");
  311. check_feature!(self, features, copy_file, "fs-copy-file");
  312. check_feature!(self, features, create_dir, "fs-create-dir");
  313. check_feature!(self, features, remove_dir, "fs-remove-dir");
  314. check_feature!(self, features, remove_file, "fs-remove-file");
  315. check_feature!(self, features, rename_file, "fs-rename-file");
  316. check_feature!(self, features, path, "fs-path");
  317. features
  318. }
  319. }
  320. }
  321. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  322. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  323. struct WindowAllowlistConfig {
  324. #[serde(default)]
  325. all: bool,
  326. #[serde(default)]
  327. create: bool,
  328. }
  329. impl Allowlist for WindowAllowlistConfig {
  330. fn to_features(&self) -> Vec<&str> {
  331. if self.all {
  332. vec!["window-all"]
  333. } else {
  334. let mut features = Vec::new();
  335. check_feature!(self, features, create, "window-create");
  336. features
  337. }
  338. }
  339. }
  340. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  341. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  342. struct ShellAllowlistConfig {
  343. #[serde(default)]
  344. all: bool,
  345. #[serde(default)]
  346. execute: bool,
  347. #[serde(default)]
  348. open: bool,
  349. }
  350. impl Allowlist for ShellAllowlistConfig {
  351. fn to_features(&self) -> Vec<&str> {
  352. if self.all {
  353. vec!["shell-all"]
  354. } else {
  355. let mut features = Vec::new();
  356. check_feature!(self, features, execute, "shell-execute");
  357. check_feature!(self, features, open, "shell-open");
  358. features
  359. }
  360. }
  361. }
  362. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  363. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  364. struct DialogAllowlistConfig {
  365. #[serde(default)]
  366. all: bool,
  367. #[serde(default)]
  368. open: bool,
  369. #[serde(default)]
  370. save: bool,
  371. }
  372. impl Allowlist for DialogAllowlistConfig {
  373. fn to_features(&self) -> Vec<&str> {
  374. if self.all {
  375. vec!["dialog-all"]
  376. } else {
  377. let mut features = Vec::new();
  378. check_feature!(self, features, open, "dialog-open");
  379. check_feature!(self, features, save, "dialog-save");
  380. features
  381. }
  382. }
  383. }
  384. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  385. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  386. struct HttpAllowlistConfig {
  387. #[serde(default)]
  388. all: bool,
  389. #[serde(default)]
  390. request: bool,
  391. }
  392. impl Allowlist for HttpAllowlistConfig {
  393. fn to_features(&self) -> Vec<&str> {
  394. if self.all {
  395. vec!["http-all"]
  396. } else {
  397. let mut features = Vec::new();
  398. check_feature!(self, features, request, "http-request");
  399. features
  400. }
  401. }
  402. }
  403. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  404. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  405. struct NotificationAllowlistConfig {
  406. #[serde(default)]
  407. all: bool,
  408. }
  409. impl Allowlist for NotificationAllowlistConfig {
  410. fn to_features(&self) -> Vec<&str> {
  411. if self.all {
  412. vec!["notification-all"]
  413. } else {
  414. vec![]
  415. }
  416. }
  417. }
  418. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  419. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  420. struct GlobalShortcutAllowlistConfig {
  421. #[serde(default)]
  422. all: bool,
  423. }
  424. impl Allowlist for GlobalShortcutAllowlistConfig {
  425. fn to_features(&self) -> Vec<&str> {
  426. if self.all {
  427. vec!["global-shortcut-all"]
  428. } else {
  429. vec![]
  430. }
  431. }
  432. }
  433. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  434. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  435. struct AllowlistConfig {
  436. #[serde(default)]
  437. all: bool,
  438. #[serde(default)]
  439. fs: FsAllowlistConfig,
  440. #[serde(default)]
  441. window: WindowAllowlistConfig,
  442. #[serde(default)]
  443. shell: ShellAllowlistConfig,
  444. #[serde(default)]
  445. dialog: DialogAllowlistConfig,
  446. #[serde(default)]
  447. http: HttpAllowlistConfig,
  448. #[serde(default)]
  449. notification: NotificationAllowlistConfig,
  450. #[serde(default)]
  451. global_shortcut: GlobalShortcutAllowlistConfig,
  452. }
  453. impl Allowlist for AllowlistConfig {
  454. fn to_features(&self) -> Vec<&str> {
  455. if self.all {
  456. vec!["api-all"]
  457. } else {
  458. let mut features = Vec::new();
  459. features.extend(self.fs.to_features());
  460. features.extend(self.window.to_features());
  461. features.extend(self.shell.to_features());
  462. features.extend(self.dialog.to_features());
  463. features.extend(self.http.to_features());
  464. features.extend(self.notification.to_features());
  465. features.extend(self.global_shortcut.to_features());
  466. features
  467. }
  468. }
  469. }
  470. /// The Tauri configuration object.
  471. #[skip_serializing_none]
  472. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  473. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  474. pub struct TauriConfig {
  475. /// The windows configuration.
  476. #[serde(default)]
  477. pub windows: Vec<WindowConfig>,
  478. /// The CLI configuration.
  479. pub cli: Option<CliConfig>,
  480. /// The bundler configuration.
  481. #[serde(default)]
  482. pub bundle: BundleConfig,
  483. #[serde(default)]
  484. allowlist: AllowlistConfig,
  485. pub security: Option<SecurityConfig>,
  486. /// The updater configuration.
  487. #[serde(default = "default_updater")]
  488. pub updater: UpdaterConfig,
  489. }
  490. impl TauriConfig {
  491. #[allow(dead_code)]
  492. pub fn features(&self) -> Vec<&str> {
  493. self.allowlist.to_features()
  494. }
  495. }
  496. #[skip_serializing_none]
  497. #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  498. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  499. pub struct UpdaterConfig {
  500. /// Whether the updater is active or not.
  501. pub active: bool,
  502. /// Display built-in dialog or use event system if disabled.
  503. #[serde(default = "default_dialog")]
  504. pub dialog: Option<bool>,
  505. /// The updater endpoints.
  506. pub endpoints: Option<Vec<String>>,
  507. /// Optional pubkey.
  508. pub pubkey: Option<String>,
  509. }
  510. // We enable the unnecessary_wraps because we need
  511. // to use an Option for dialog otherwise the CLI schema will mark
  512. // the dialog as a required field which is not as we default it to true.
  513. #[allow(clippy::unnecessary_wraps)]
  514. fn default_dialog() -> Option<bool> {
  515. Some(true)
  516. }
  517. /// The Build configuration object.
  518. #[skip_serializing_none]
  519. #[derive(Debug, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  520. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  521. pub struct BuildConfig {
  522. /// the app's dev server URL, or the path to the directory containing an index.html file
  523. #[serde(default = "default_dev_path")]
  524. pub dev_path: String,
  525. /// the path to the app's dist dir. This path must contain your index.html file.
  526. #[serde(default = "default_dist_dir")]
  527. pub dist_dir: String,
  528. /// a shell command to run before `tauri dev` kicks in
  529. pub before_dev_command: Option<String>,
  530. /// a shell command to run before `tauri build` kicks in
  531. pub before_build_command: Option<String>,
  532. /// Whether we should inject the Tauri API on `window.__TAURI__` or not.
  533. #[serde(default)]
  534. pub with_global_tauri: bool,
  535. }
  536. fn default_dev_path() -> String {
  537. "".to_string()
  538. }
  539. fn default_dist_dir() -> String {
  540. "../dist".to_string()
  541. }
  542. type JsonObject = HashMap<String, JsonValue>;
  543. /// The tauri.conf.json mapper.
  544. #[skip_serializing_none]
  545. #[derive(Debug, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
  546. #[serde(rename_all = "camelCase", deny_unknown_fields)]
  547. pub struct Config {
  548. /// Package settings.
  549. #[serde(default)]
  550. pub package: PackageConfig,
  551. /// The Tauri configuration.
  552. #[serde(default)]
  553. pub tauri: TauriConfig,
  554. /// The build configuration.
  555. #[serde(default = "default_build")]
  556. pub build: BuildConfig,
  557. /// The plugins config.
  558. #[serde(default)]
  559. pub plugins: HashMap<String, JsonObject>,
  560. }
  561. fn default_build() -> BuildConfig {
  562. BuildConfig {
  563. dev_path: default_dev_path(),
  564. dist_dir: default_dist_dir(),
  565. before_dev_command: None,
  566. before_build_command: None,
  567. with_global_tauri: false,
  568. }
  569. }
  570. fn default_updater() -> UpdaterConfig {
  571. UpdaterConfig {
  572. active: false,
  573. dialog: Some(true),
  574. endpoints: None,
  575. pubkey: None,
  576. }
  577. }