settings.rs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. use structopt::StructOpt;
  19. use structopt_toml::{serde::Deserialize, StructOptToml};
  20. use darkfi::{net::settings::SettingsOpt, rpc::settings::RpcSettingsOpt};
  21. pub const CONFIG_FILE: &str = "taud_config.toml";
  22. pub const CONFIG_FILE_CONTENTS: &str = include_str!("../taud_config.toml");
  23. /// taud cli
  24. #[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
  25. #[serde(default)]
  26. #[structopt(name = "taud")]
  27. pub struct Args {
  28. #[structopt(long)]
  29. /// Sets a custom config file
  30. pub config: Option<String>,
  31. #[structopt(long, default_value = "~/.local/share/darkfi/taud_db")]
  32. /// Sets Datastore Path
  33. pub datastore: String,
  34. #[structopt(long, default_value = "~/.local/share/darkfi/replayed_taud_db")]
  35. /// Replay logs (DB) path
  36. pub replay_datastore: String,
  37. #[structopt(long)]
  38. /// Flag to store Sled DB instructions
  39. pub replay_mode: bool,
  40. #[structopt(flatten)]
  41. /// JSON-RPC settings
  42. pub rpc: RpcSettingsOpt,
  43. #[structopt(flatten)]
  44. /// P2P network settings
  45. pub net: SettingsOpt,
  46. #[structopt(short, parse(from_occurrences))]
  47. /// Increase verbosity
  48. pub verbose: u8,
  49. #[structopt(long)]
  50. /// Generate a new workspace
  51. pub generate: bool,
  52. #[structopt(long)]
  53. /// Secret Key To Encrypt/Decrypt tasks
  54. pub workspaces: Vec<String>,
  55. #[structopt(long)]
  56. /// Write access key
  57. pub write: Option<String>,
  58. #[structopt(long)]
  59. /// Password
  60. pub password: Option<String>,
  61. #[structopt(long)]
  62. /// Clean all the local data in datastore path
  63. /// (BE CAREFUL) Check the datastore path in the config file before running this
  64. pub refresh: bool,
  65. #[structopt(long)]
  66. /// Current display name
  67. pub nickname: Option<String>,
  68. #[structopt(long)]
  69. /// Flag to skip syncing the DAG (no history)
  70. pub skip_dag_sync: bool,
  71. #[structopt(long, default_value = "/tmp/tau_pipe")]
  72. /// Named pipe path
  73. pub pipe_path: String,
  74. #[structopt(long)]
  75. // Whether to pipe notifications or not
  76. pub piped: bool,
  77. #[structopt(short, long)]
  78. /// Set log file to ouput into
  79. pub log: Option<String>,
  80. }