workerlib/
arguments.rs

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