All checks were successful
build-and-release / build (developers) (push) Successful in 1m27s
build-and-release / build (employees) (push) Successful in 1m52s
build-and-release / build (customers) (push) Successful in 1m56s
build-and-release / build (cron) (push) Successful in 2m16s
build-and-release / build (companies) (push) Successful in 2m21s
build-and-release / build (catering-services) (push) Successful in 2m29s
build-and-release / build (gateway) (push) Successful in 39s
build-and-release / build (fitness-trainers) (push) Successful in 2m0s
build-and-release / build (graphic-designers) (push) Successful in 1m52s
build-and-release / build (jobs) (push) Successful in 1m34s
build-and-release / build (job-seekers) (push) Successful in 2m4s
build-and-release / build (photographers) (push) Successful in 1m35s
build-and-release / build (makeup-artists) (push) Successful in 2m41s
build-and-release / build (payments) (push) Successful in 3m15s
build-and-release / build (tutors) (push) Successful in 2m16s
build-and-release / build (social-media-managers) (push) Successful in 2m33s
build-and-release / build (ugc-content-creators) (push) Successful in 2m47s
build-and-release / build (video-editors) (push) Successful in 2m32s
build-and-release / build (users) (push) Successful in 4m11s
Document upload endpoints (job_seekers, customers, companies, and the profession_shared crate used by 10 profession apps) returned a generic "File upload failed" 500 on any storage error, hiding the actual cause from both the API response and (for job_seekers/companies) the server logs, which only printed anyhow's outer context via Display instead of the full error chain via Debug. Also add an explicit DefaultBodyLimit(11MB) to every affected app's router — none had one, so axum's implicit 2MB default could silently reject uploads under the UI's advertised 10MB cap.
63 lines
2 KiB
Rust
63 lines
2 KiB
Rust
// retrigger-build-marker
|
|
#![allow(dead_code)]
|
|
|
|
mod handlers;
|
|
|
|
use axum::{extract::DefaultBodyLimit, routing::get, Router};
|
|
use cache::RedisPool;
|
|
use std::net::SocketAddr;
|
|
use std::sync::Arc;
|
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
|
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
pub pool: sqlx::PgPool,
|
|
pub storage: Arc<storage::StorageClient>,
|
|
pub mail: Arc<email::Mailer>,
|
|
pub redis: RedisPool,
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
tracing_subscriber::registry()
|
|
.with(tracing_subscriber::EnvFilter::new(
|
|
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
|
|
))
|
|
.with(tracing_subscriber::fmt::layer())
|
|
.init();
|
|
|
|
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
|
let pool = sqlx::postgres::PgPoolOptions::new()
|
|
.max_connections(5)
|
|
.connect(&database_url)
|
|
.await
|
|
.expect("Failed to connect to postgres");
|
|
|
|
tracing::info!("Job Seekers service — connected to database");
|
|
|
|
let storage = Arc::new(storage::StorageClient::from_env().await);
|
|
let mailer = Arc::new(email::Mailer::new());
|
|
|
|
let redis_url = std::env::var("REDIS_URL").expect("REDIS_URL must be set");
|
|
let redis = cache::connect(&redis_url).await.expect("Failed to connect to Redis");
|
|
tracing::info!("Job Seekers service — connected to Redis");
|
|
|
|
let state = AppState { pool, storage, mail: mailer, redis };
|
|
|
|
let app = Router::new()
|
|
.nest("/api/jobseeker", handlers::router())
|
|
.route("/health", get(|| async { "Job Seekers OK" }))
|
|
.layer(DefaultBodyLimit::max(11 * 1024 * 1024))
|
|
.with_state(state);
|
|
|
|
let port: u16 = std::env::var("PORT")
|
|
.unwrap_or_else(|_| "9104".to_string())
|
|
.parse()
|
|
.expect("PORT must be a number");
|
|
let addr = SocketAddr::from(([0, 0, 0, 0], port));
|
|
|
|
tracing::info!("Job Seekers service listening on {}", addr);
|
|
|
|
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
|
|
axum::serve(listener, app).await.unwrap();
|
|
}
|