workerlib/arguments.rs
1//! Arguments used across all worker operations
2//!
3
4use std::path::{Path, PathBuf};
5
6use crate::WarningConfig;
7
8/// Options specifying how to carry out the mirroring operations
9#[derive(Debug, Clone)]
10pub struct Arguments {
11 /// Directory for holding intermediate git repos and other internal data
12 pub working_area: PathBuf,
13
14 /// Validate SSL/TLS server certifications.
15 pub check_ssl_certificates: bool,
16
17 /// The maximum number of redirections that should be followed by the client
18 pub maximum_redirects: u32,
19
20 /// If the git binary should be preferred or if libgit2 should be used.
21 ///
22 /// Libgit2 has stronger security properties guarantee while the git
23 /// binary has better performance. Note that raw-file mirrors only use
24 /// the git binary due to git's integration with git-lfs.
25 pub use_git_binary: Option<bool>,
26
27 /// Number of threads to use for cloning.
28 ///
29 /// This setting only affects the operation when using the git binary
30 pub pack_threads: Option<usize>,
31
32 /// Path to the global git configuration for use with git commands, must
33 /// already be configured.
34 pub git_config_path: PathBuf,
35
36 /// If sha256sums are required for all raw files.
37 ///
38 /// NOTE: This will default to true in a future release.
39 pub sha256sum_required: bool,
40
41 /// Individual controls for setting warnings on/off
42 pub disable_warnings: WarningConfig,
43}
44
45impl Default for Arguments {
46 fn default() -> Self {
47 Self {
48 working_area: PathBuf::from("workd"),
49 check_ssl_certificates: true,
50 maximum_redirects: 0,
51 use_git_binary: None,
52 pack_threads: None,
53 git_config_path: Path::new(crate::git_config::DEFAULT_GIT_CONFIG_PATH).to_path_buf(),
54 sha256sum_required: false,
55 disable_warnings: WarningConfig::default(),
56 }
57 }
58}