feat: lay the ground for login
This commit is contained in:
@@ -10,6 +10,7 @@ pub struct AppState {
|
||||
pub args: crate::args::Args,
|
||||
pub config: &'static crate::conf::Config,
|
||||
pub cache: caches::AppCache<'static>,
|
||||
pub db: crate::db::DB,
|
||||
}
|
||||
|
||||
/// Type alias to be used just as `data: AppData,` extractor in [`actix_web`] request handlers.
|
||||
@@ -17,7 +18,11 @@ pub type AppData = static_app_data::StaticAppDataExtractor<&'static AppState>;
|
||||
|
||||
/// Leaks memory for the sake of not atomic'ing all over.
|
||||
#[expect(clippy::missing_errors_doc)]
|
||||
pub async fn start_app(args: crate::args::Args, config: crate::conf::Config) -> io::Result<()> {
|
||||
pub async fn start_app(
|
||||
args: crate::args::Args,
|
||||
config: crate::conf::Config,
|
||||
db: crate::db::DB,
|
||||
) -> io::Result<()> {
|
||||
use crate::consts::web_scopes as ws;
|
||||
|
||||
let config = Box::leak(Box::new(config));
|
||||
@@ -28,6 +33,7 @@ pub async fn start_app(args: crate::args::Args, config: crate::conf::Config) ->
|
||||
args,
|
||||
config,
|
||||
cache,
|
||||
db,
|
||||
}));
|
||||
|
||||
println!(
|
||||
@@ -41,6 +47,7 @@ pub async fn start_app(args: crate::args::Args, config: crate::conf::Config) ->
|
||||
.wrap(middleware::Logger::new("%a (%{r}a) %r -> %s, %b B in %T s"))
|
||||
.wrap(middleware::NormalizePath::trim())
|
||||
.service(services::images::make_scope(ws::IMAGES))
|
||||
.service(services::login::make_scope(ws::LOGIN))
|
||||
.default_service(web::to(services::not_found::not_found))
|
||||
})
|
||||
.bind(&app.config.server.listen)?
|
||||
|
||||
Reference in New Issue
Block a user