fud/
settings.rs

1/* This file is part of DarkFi (https://dark.fi)
2 *
3 * Copyright (C) 2020-2025 Dyne.org foundation
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 */
18
19use structopt::StructOpt;
20use structopt_toml::{serde::Deserialize, StructOptToml};
21
22use darkfi::{
23    cli_desc, dht::DhtSettingsOpt, net::settings::SettingsOpt, rpc::settings::RpcSettingsOpt,
24};
25
26use crate::pow::PowSettingsOpt;
27
28pub const CONFIG_FILE: &str = "fud_config.toml";
29pub const CONFIG_FILE_CONTENTS: &str = include_str!("../fud_config.toml");
30
31#[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
32#[serde(default)]
33#[structopt(name = "fud", about = cli_desc!())]
34pub struct Args {
35    #[structopt(short, parse(from_occurrences))]
36    /// Increase verbosity (-vvv supported)
37    pub verbose: u8,
38
39    #[structopt(short, long)]
40    /// Configuration file to use
41    pub config: Option<String>,
42
43    #[structopt(long)]
44    /// Set log file path to output daemon logs into
45    pub log: Option<String>,
46
47    #[structopt(long, default_value = "~/.local/share/darkfi/fud")]
48    /// Base directory for filesystem storage
49    pub base_dir: String,
50
51    #[structopt(short, long)]
52    /// Default path to store downloaded files (defaults to <base_dir>/downloads)
53    pub downloads_path: Option<String>,
54
55    #[structopt(long, default_value = "60")]
56    /// Chunk transfer timeout in seconds
57    pub chunk_timeout: u64,
58
59    #[structopt(flatten)]
60    /// Network settings
61    pub net: SettingsOpt,
62
63    #[structopt(flatten)]
64    /// JSON-RPC settings
65    pub rpc: RpcSettingsOpt,
66
67    #[structopt(flatten)]
68    /// DHT settings
69    pub dht: DhtSettingsOpt,
70
71    #[structopt(flatten)]
72    /// PoW settings
73    pub pow: PowSettingsOpt,
74}