settings.rs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 serde::Deserialize;
  19. use structopt::StructOpt;
  20. use structopt_toml::StructOptToml;
  21. use url::Url;
  22. use darkfi::net::settings::SettingsOpt;
  23. pub const CONFIG_FILE: &str = "taud_config.toml";
  24. pub const CONFIG_FILE_CONTENTS: &str = include_str!("../../taud_config.toml");
  25. /// taud cli
  26. #[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
  27. #[serde(default)]
  28. #[structopt(name = "taud")]
  29. pub struct Args {
  30. /// Sets a custom config file
  31. #[structopt(long)]
  32. pub config: Option<String>,
  33. /// JSON-RPC listen URL
  34. #[structopt(long = "rpc", default_value = "tcp://127.0.0.1:23330")]
  35. pub rpc_listen: Url,
  36. /// Sets Datastore Path
  37. #[structopt(long, default_value = "~/.tau")]
  38. pub datastore: String,
  39. #[structopt(flatten)]
  40. pub net: SettingsOpt,
  41. /// Increase verbosity
  42. #[structopt(short, parse(from_occurrences))]
  43. pub verbose: u8,
  44. /// Generate a new workspace
  45. #[structopt(long)]
  46. pub generate: bool,
  47. /// Secret Key To Encrypt/Decrypt tasks
  48. #[structopt(long)]
  49. pub workspaces: Vec<String>,
  50. /// Clean all the local data in datastore path
  51. /// (BE CAREFULL) Check the datastore path in the config file before running this
  52. #[structopt(long)]
  53. pub refresh: bool,
  54. /// Current display name
  55. #[structopt(long)]
  56. pub nickname: Option<String>,
  57. // Whether to pipe notifications or not
  58. #[structopt(long)]
  59. pub piped: bool,
  60. }