settings.rs 2.7 KB

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