Added docker building.

This commit is contained in:
2023-02-20 01:15:47 +00:00
parent 70224f337a
commit 02b5a13902
8 changed files with 64 additions and 36 deletions

View File

@ -1,15 +1,15 @@
use std::sync::Arc;
use tokio::sync::RwLock;
use actix_web::{web::Data, App, HttpServer};
use actix_web::{dev::Server, web::Data, App, HttpServer};
use crate::args::ServerConfig;
use super::routes::{healthcheck, index, login};
pub async fn start(args: ServerConfig, token: Arc<RwLock<Option<String>>>) -> anyhow::Result<()> {
pub fn create(args: ServerConfig, token: Arc<RwLock<Option<String>>>) -> anyhow::Result<Server> {
let addr = (args.host.clone(), args.port);
HttpServer::new(move || {
let server = HttpServer::new(move || {
App::new()
.wrap(actix_web::middleware::Logger::new(
"\"%r\" \"-\" \"%s\" \"%a\" \"%D\"",
@ -23,7 +23,6 @@ pub async fn start(args: ServerConfig, token: Arc<RwLock<Option<String>>>) -> an
})
.bind(addr)?
.workers(1)
.run()
.await?;
Ok(())
.run();
Ok(server)
}

View File

@ -3,4 +3,4 @@ mod routes;
mod schema;
mod templates;
pub use main::start;
pub use main::create;