mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
Pass AppState instead of Session State
This commit is contained in:
parent
46e7c143d6
commit
2f48c42677
1 changed files with 4 additions and 6 deletions
10
src/main.rs
10
src/main.rs
|
@ -26,20 +26,18 @@ async fn main() {
|
|||
// TODO Check Config Manager Setup Error
|
||||
let config_manager = ConfigManager::new().unwrap();
|
||||
|
||||
let session_state = SessionState {
|
||||
sessions: Arc::new(RwLock::new(HashMap::new())),
|
||||
};
|
||||
|
||||
let app_state = AppState {
|
||||
config_manager,
|
||||
session_state: session_state.clone(),
|
||||
session_state: SessionState {
|
||||
sessions: Arc::new(RwLock::new(HashMap::new())),
|
||||
},
|
||||
};
|
||||
|
||||
// Note: The Router Works Bottom Up, So the auth middleware will only applies to everything above it.
|
||||
let main_router = Router::new()
|
||||
.merge(web::rpc::routes())
|
||||
.layer(middleware::from_fn_with_state(
|
||||
session_state,
|
||||
app_state.clone(),
|
||||
web::auth::mw_auth,
|
||||
))
|
||||
.merge(web::auth::routes())
|
||||
|
|
Loading…
Add table
Reference in a new issue