web/src/main.rs
2023-10-16 01:36:02 +02:00

27 lines
No EOL
705 B
Rust

use std::env;
use actix_files as fs;
use actix_web::{App, HttpServer, middleware};
use env_logger;
mod relay;
mod well_known;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
HttpServer::new(|| {
App::new()
.wrap(middleware::Logger::default())
.configure(relay::configure)
.configure(well_known::configure)
.service(
fs::Files::new("/", "./public/")
.index_file("index.html")
)
})
.bind(env::var("BIND_ADDRESS").unwrap_or(String::from("0.0.0.0:8080")))?
.run()
.await
}