cuprated/config/
fs.rs

1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5use cuprate_helper::fs::{CUPRATE_CACHE_DIR, CUPRATE_DATA_DIR};
6
7use super::macros::config_struct;
8
9config_struct! {
10    /// The file system config.
11    #[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
12    #[serde(deny_unknown_fields, default)]
13    pub struct FileSystemConfig {
14        #[comment_out = true]
15        /// The data directory.
16        ///
17        /// This directory store the blockchain, transaction pool,
18        /// log files, and any misc data files.
19        ///
20        /// The default directories for each OS:
21        ///
22        /// | OS      | Path                                                |
23        /// |---------|-----------------------------------------------------|
24        /// | Windows | "C:\Users\Alice\AppData\Roaming\Cuprate\"           |
25        /// | macOS   | "/Users/Alice/Library/Application Support/Cuprate/" |
26        /// | Linux   | "/home/alice/.local/share/cuprate/"                 |
27        pub data_directory: PathBuf,
28
29        #[comment_out = true]
30        /// The cache directory.
31        ///
32        /// This directory store cache files.
33        /// Although not recommended, this directory can be
34        /// deleted without major disruption to cuprated.
35        ///
36        /// The default directories for each OS:
37        ///
38        /// | OS      | Path                                    |
39        /// |---------|-----------------------------------------|
40        /// | Windows | "C:\Users\Alice\AppData\Local\Cuprate\" |
41        /// | macOS   | "/Users/Alice/Library/Caches/Cuprate/"  |
42        /// | Linux   | "/home/alice/.cache/cuprate/"           |
43        pub cache_directory: PathBuf,
44    }
45}
46
47impl Default for FileSystemConfig {
48    fn default() -> Self {
49        Self {
50            data_directory: CUPRATE_DATA_DIR.to_path_buf(),
51            cache_directory: CUPRATE_CACHE_DIR.to_path_buf(),
52        }
53    }
54}