30
crates/forage-server/src/state.rs
Normal file
30
crates/forage-server/src/state.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::templates::TemplateEngine;
|
||||
use forage_core::auth::ForestAuth;
|
||||
use forage_core::platform::ForestPlatform;
|
||||
use forage_core::session::SessionStore;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub templates: TemplateEngine,
|
||||
pub forest_client: Arc<dyn ForestAuth>,
|
||||
pub platform_client: Arc<dyn ForestPlatform>,
|
||||
pub sessions: Arc<dyn SessionStore>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub fn new(
|
||||
templates: TemplateEngine,
|
||||
forest_client: Arc<dyn ForestAuth>,
|
||||
platform_client: Arc<dyn ForestPlatform>,
|
||||
sessions: Arc<dyn SessionStore>,
|
||||
) -> Self {
|
||||
Self {
|
||||
templates,
|
||||
forest_client,
|
||||
platform_client,
|
||||
sessions,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user