settings.rs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* This file is part of DarkFi (https://dark.fi)
  2. *
  3. * Copyright (C) 2020-2023 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/tau")]
  37. pub datastore: String,
  38. #[structopt(flatten)]
  39. pub net: SettingsOpt,
  40. /// Increase verbosity
  41. #[structopt(short, parse(from_occurrences))]
  42. pub verbose: u8,
  43. /// Generate a new workspace
  44. #[structopt(long)]
  45. pub generate: bool,
  46. /// Secret Key To Encrypt/Decrypt tasks
  47. #[structopt(long)]
  48. pub workspaces: Vec<String>,
  49. /// Clean all the local data in datastore path
  50. /// (BE CAREFUL) Check the datastore path in the config file before running this
  51. #[structopt(long)]
  52. pub refresh: bool,
  53. /// Current display name
  54. #[structopt(long)]
  55. pub nickname: Option<String>,
  56. #[structopt(long)]
  57. pub skip_dag_sync: bool,
  58. // Whether to pipe notifications or not
  59. #[structopt(long)]
  60. pub piped: bool,
  61. #[structopt(short, long)]
  62. /// Set log file to ouput into
  63. pub log: Option<String>,
  64. }