config_definition.rs 20 KB

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