You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
mod database; |
|
mod graphql; |
|
|
|
use clap::{App, Arg}; |
|
use database::scan_dbs; |
|
use graphql::server; |
|
|
|
#[actix_rt::main] |
|
async fn main() -> std::io::Result<()> { |
|
let cmd = App::new("Riplog") |
|
.version("1.0") |
|
.arg( |
|
Arg::with_name("basedir") |
|
.required(true) |
|
.short("d") |
|
.help("Base directory containing ripcord db files") |
|
.default_value(".") |
|
.index(1), |
|
) |
|
.arg( |
|
Arg::with_name("static") |
|
.required(true) |
|
.short("s") |
|
.help("Folder containing static assets (frontend)") |
|
.default_value("frontend/dist"), |
|
) |
|
.arg( |
|
Arg::with_name("bind") |
|
.required(true) |
|
.short("b") |
|
.help("Address to bind to") |
|
.default_value("127.0.0.1:8080"), |
|
) |
|
.get_matches(); |
|
|
|
let basedir = cmd.value_of("basedir").unwrap(); |
|
let addr = cmd.value_of("bind").unwrap(); |
|
let static_dir = String::from(cmd.value_of("static").unwrap()); |
|
let logs = scan_dbs(basedir); |
|
println!("Loaded data for {} workspaces", logs.len()); |
|
server(addr, static_dir, logs).await |
|
}
|
|
|