2025-04-06 09:55:29 -04:00
|
|
|
#![forbid(unsafe_code)]
|
2026-01-01 10:37:56 -05:00
|
|
|
mod cli;
|
2025-03-02 09:52:44 -05:00
|
|
|
mod robocraft;
|
|
|
|
|
|
2026-01-01 10:37:56 -05:00
|
|
|
use actix_web::{App, HttpServer, Responder};
|
|
|
|
|
|
|
|
|
|
#[actix_web::get("/")]
|
|
|
|
|
async fn index() -> impl Responder {
|
2025-04-02 20:59:52 -04:00
|
|
|
let name = env!("CARGO_PKG_NAME");
|
|
|
|
|
let version = env!("CARGO_PKG_VERSION");
|
2025-05-30 23:11:51 -04:00
|
|
|
let git_version = git_version::git_version!(args = ["--always", "--dirty=+"]);
|
2025-04-02 20:59:52 -04:00
|
|
|
let authors = env!("CARGO_PKG_AUTHORS");
|
|
|
|
|
let license = env!("CARGO_PKG_LICENSE");
|
|
|
|
|
let repo = env!("CARGO_PKG_REPOSITORY");
|
2025-05-30 23:11:51 -04:00
|
|
|
format!("{} {}:{} by [{}]\n{}\n{}", name, version, git_version, authors, license, repo)
|
2025-03-02 09:52:44 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-01 10:37:56 -05:00
|
|
|
#[actix_web::main]
|
|
|
|
|
async fn main() -> std::io::Result<()> {
|
2025-03-02 09:52:44 -05:00
|
|
|
env_logger::init();
|
2026-01-01 10:37:56 -05:00
|
|
|
let cli_args = cli::CliArgs::get();
|
|
|
|
|
|
|
|
|
|
let cli_args2 = actix_web::web::Data::new(cli_args.clone());
|
|
|
|
|
|
|
|
|
|
HttpServer::new(move || {
|
|
|
|
|
App::new()
|
|
|
|
|
.app_data(cli_args2.clone())
|
|
|
|
|
.service(index)
|
|
|
|
|
.service(robocraft::robopay_store)
|
|
|
|
|
})
|
|
|
|
|
.bind((cli_args.ip, cli_args.port))?
|
|
|
|
|
.run()
|
|
|
|
|
.await
|
2025-03-02 09:52:44 -05:00
|
|
|
}
|
|
|
|
|
|