32 lines
598 B
Rust
32 lines
598 B
Rust
use std::{
|
|
error::Error,
|
|
path::PathBuf,
|
|
};
|
|
|
|
use structopt::StructOpt;
|
|
|
|
#[derive (Debug, StructOpt)]
|
|
struct Opt {
|
|
#[structopt (name = "RELAY_URL")]
|
|
relay_url: String,
|
|
|
|
#[structopt (name = "SERVER_NAME")]
|
|
server_name: String,
|
|
|
|
#[structopt (long)]
|
|
file_server_root: Option <PathBuf>,
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main () -> Result <(), Box <dyn Error>> {
|
|
let opt = Opt::from_args ();
|
|
|
|
let opt = ptth::server::Opt {
|
|
relay_url: opt.relay_url,
|
|
server_name: opt.server_name,
|
|
file_server_root: opt.file_server_root.unwrap_or ("/home/user".into ()),
|
|
};
|
|
|
|
ptth::server::main (opt).await
|
|
}
|