1
// Test-only file to reexport the modules for testing
2
#[macro_use]
3
extern crate rust_i18n;
4

            
5
i18n!("locales", fallback = "en");
6

            
7
pub mod auth_keys;
8
pub mod client_ip;
9
pub mod config;
10
pub mod files;
11
pub mod handler;
12
pub mod jwt_auth;
13
pub mod model;
14
pub mod pages;
15
pub mod rate_limit;
16
pub mod redirect_middleware;
17
pub mod response;
18
pub mod route;
19
pub mod telemetry;
20
pub mod token;
21

            
22
pub use config::Config;
23
pub use model::{LoginUserSchema, RegisterUserSchema, User};
24
pub use token::{TokenClaims, TokenDetails};
25

            
26
use redis::Client;
27
use std::sync::Arc;
28
use tokio::sync::Mutex;
29

            
30
pub struct AppState {
31
    pub conf: Config,
32
    pub redis_client: Client,
33
    pub frac: i64,
34
    pub user: Mutex<Option<User>>,
35
}
36

            
37
impl AppState {
38
    #[must_use]
39
101
    pub fn new(conf: Config, redis_client: Client) -> Arc<Self> {
40
101
        Arc::new(Self {
41
101
            conf,
42
101
            redis_client,
43
101
            frac: 0,
44
101
            user: Mutex::new(None),
45
101
        })
46
101
    }
47
}