This commit is contained in:
2025-10-09 22:41:04 +02:00
parent 768f8cb21c
commit 4a428b9af6
13 changed files with 1019 additions and 50 deletions
+10 -15
View File
@@ -1,23 +1,17 @@
mod auth;
mod config;
mod db;
mod error;
mod models;
mod routes;
mod s3;
mod schema;
mod state;
use std::net::SocketAddr;
use std::sync::Arc;
use tokio::net::TcpListener;
use tower::make::Shared;
use tracing_subscriber::EnvFilter;
use crate::auth::jwt::JwtService;
use crate::config::AppConfig;
use crate::s3::build_client;
use crate::state::AppState;
use paperless_backend::auth::jwt::JwtService;
use paperless_backend::config::AppConfig;
use paperless_backend::db;
use paperless_backend::routes;
use paperless_backend::s3::build_client;
use paperless_backend::state::AppState;
use paperless_backend::storage::S3Storage;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
@@ -27,9 +21,10 @@ async fn main() -> anyhow::Result<()> {
let config = AppConfig::from_env()?;
let pool = db::init_pool(&config.database_url)?;
let s3_client = build_client(&config).await?;
let storage = Arc::new(S3Storage::new(s3_client, config.s3_bucket.clone()));
let jwt = JwtService::from_config(&config)?;
let state = AppState::new(pool, config, s3_client, jwt);
let state = AppState::new(pool, config, storage, jwt);
let router = routes::create_router(state.clone());