settings.rs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. use std::net::SocketAddr;
  2. use darkfi::net;
  3. use serde::Deserialize;
  4. use structopt::StructOpt;
  5. use structopt_toml::StructOptToml;
  6. pub const CONFIG_FILE: &str = "taud_config.toml";
  7. pub const CONFIG_FILE_CONTENTS: &str = include_str!("../../taud_config.toml");
  8. /// taud cli
  9. #[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
  10. #[serde(default)]
  11. #[structopt(name = "taud")]
  12. pub struct Args {
  13. /// Sets a custom config file
  14. #[structopt(long)]
  15. pub config: Option<String>,
  16. /// JSON-RPC listen URL
  17. #[structopt(long, default_value = "127.0.0.1:8857")]
  18. pub rpc_listen: SocketAddr,
  19. /// Sets Datastore Path
  20. #[structopt(long, default_value = "~/.config/tau")]
  21. pub datastore: String,
  22. #[structopt(subcommand)]
  23. pub command: Option<Command>,
  24. /// Increase verbosity
  25. #[structopt(short, parse(from_occurrences))]
  26. pub verbose: u8,
  27. }
  28. #[derive(Clone, Debug, Deserialize, StructOpt)]
  29. #[serde(tag = "type", content = "args")]
  30. pub enum Command {
  31. /// Raft net settings
  32. /// Note: Wihtout passing this flag, tau will work locally
  33. Net(net::Settings),
  34. }