gbserver/src/main.rs
Rodrigo Rodriguez (Pragmatismo) fffd7a5197
All checks were successful
GBCI / build (push) Successful in 5m56s
feat: integrate JMAP client and refactor file handling
- Added `jmap-client` dependency to Cargo.toml for JMAP email functionality.
- Created a new `email` service to handle email listing via JMAP.
- Refactored file upload and listing functionality into a dedicated `file` service.
- Introduced `AppState` struct to manage shared application state, including MinIO client and configuration.
- Updated main application to initialize and use the new services.
2025-06-20 22:11:45 -03:00

42 lines
1 KiB
Rust

use actix_web::{middleware, web, App, HttpServer};
use tracing_subscriber::fmt::format::FmtSpan;
use dotenv::dotenv;
use services::config::*;
use services::file::*;
use services::state::*;
mod services;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
dotenv().ok();
tracing_subscriber::fmt()
.with_span_events(FmtSpan::CLOSE)
.init();
// log::set_max_level(LevelFilter::Info);
let config = AppConfig::from_env();
let minio_client = init_minio(&config).await.expect("Failed to initialize Minio");
let app_state = web::Data::new(AppState {
config: Some(config.clone()),
minio_client: Some(minio_client),
});
// Start HTTP server
HttpServer::new(move || {
App::new()
.wrap(middleware::Logger::default())
.wrap(middleware::Compress::default())
.app_data(app_state.clone())
.service(upload_file)
.service(list_file)
})
.bind((config.server.host.clone(), config.server.port))?
.run()
.await
}