2023-10-16 01:36:01 +02:00
|
|
|
use std::env;
|
2023-10-16 01:36:01 +02:00
|
|
|
|
2023-10-16 01:36:01 +02:00
|
|
|
use actix_files as fs;
|
2023-10-16 01:36:01 +02:00
|
|
|
use actix_web::{App, HttpServer, middleware};
|
2023-10-16 01:36:01 +02:00
|
|
|
use env_logger;
|
|
|
|
|
|
|
|
mod relay;
|
2023-10-16 01:36:01 +02:00
|
|
|
mod well_known;
|
2023-10-16 01:36:01 +02:00
|
|
|
|
|
|
|
#[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)
|
2023-10-16 01:36:01 +02:00
|
|
|
.configure(well_known::configure)
|
2023-10-16 01:36:01 +02:00
|
|
|
.service(
|
|
|
|
fs::Files::new("/", "./public/")
|
|
|
|
.index_file("index.html")
|
|
|
|
)
|
|
|
|
})
|
2023-10-16 01:36:01 +02:00
|
|
|
.bind(env::var("BIND_ADDRESS").unwrap_or(String::from("0.0.0.0:8080")))?
|
2023-10-16 01:36:01 +02:00
|
|
|
.run()
|
|
|
|
.await
|
|
|
|
}
|