use std::{net::SocketAddrV4, path::PathBuf}; use structopt::StructOpt; pub mod user; #[derive(StructOpt, Debug, Clone)] #[structopt(name = "sparse-server")] pub struct Options { /// The location of the database to use. If not present, /// sparse will read the DATABASE_URL environment variable #[structopt(short = "d")] pub db_location: Option, /// During the startup of the program, sparse will produce an error /// if the database doesn't exist. Use this flag to instead create a new /// database #[structopt(short = "i")] pub init_ok: bool, #[structopt(subcommand)] pub command: Option, } #[derive(StructOpt, Debug, Clone)] #[structopt()] pub enum Command { /// Run the web and API server Serve { /// Address to bind to for the management interface #[structopt(default_value = "127.0.0.1:3000")] management_address: SocketAddrV4, /// Public address to bind to for the beacons to call back to #[structopt(default_value = "127.0.0.1:5000")] bind_address: SocketAddrV4, }, /// Extract the public key and print it to standard out ExtractPubKey {}, /// Perform user management User { #[structopt(subcommand)] command: UserCommand, }, } #[derive(StructOpt, Debug, Clone)] #[structopt()] pub enum UserCommand { /// List available users to sign in as List {}, /// Create a new user Create { #[structopt(short = "n")] user_name: String, }, /// Reset the password for a user who forgot their password ResetPassword { #[structopt(short = "I")] user_id: i16, }, }