2025-11-29 14:10:05 -07:00
|
|
|
mod api;
|
2025-12-20 18:19:08 -07:00
|
|
|
mod auth;
|
2025-12-16 22:23:54 -07:00
|
|
|
mod config;
|
2025-12-13 13:29:17 -07:00
|
|
|
pub mod logger;
|
2025-12-03 10:15:20 -07:00
|
|
|
mod server;
|
2025-12-17 16:40:34 -07:00
|
|
|
|
2025-12-03 10:15:20 -07:00
|
|
|
pub use server::Server;
|
|
|
|
|
|
2025-12-20 18:19:08 -07:00
|
|
|
use static_init::dynamic;
|
|
|
|
|
|
2025-12-03 10:15:20 -07:00
|
|
|
#[static_init::dynamic]
|
|
|
|
|
pub static DATABASE_TREES: Vec<&'static str> = vec!["users"];
|
|
|
|
|
|
|
|
|
|
#[static_init::dynamic]
|
|
|
|
|
pub static DEFAULT_HOST: String = "localhost".to_string();
|
|
|
|
|
#[static_init::dynamic]
|
|
|
|
|
pub static DATABASE_NAME: String = "database".to_string();
|
|
|
|
|
|
2025-12-17 17:43:08 -07:00
|
|
|
#[static_init::dynamic]
|
2025-12-21 00:35:28 -07:00
|
|
|
pub static SERVER_CONFIG: unshell_manager::PayloadConfig = unshell_manager::PayloadConfig {
|
2025-12-17 17:43:08 -07:00
|
|
|
id: "Server",
|
|
|
|
|
components: Vec::new(),
|
|
|
|
|
runtime_config: Vec::new(),
|
|
|
|
|
};
|
2025-12-20 18:19:08 -07:00
|
|
|
|
|
|
|
|
// Constants for server config
|
|
|
|
|
pub use api::start_api;
|
|
|
|
|
use chrono::Duration;
|
|
|
|
|
use jsonwebtoken::{DecodingKey, EncodingKey};
|
|
|
|
|
|
|
|
|
|
static EXPIRE_DURATION: Duration = Duration::hours(12);
|
|
|
|
|
|
|
|
|
|
#[dynamic]
|
|
|
|
|
static JWT_SECRET: String = std::env::var("JWT_SECRET").expect("JWT_SECRET must be set");
|
|
|
|
|
|
|
|
|
|
#[dynamic]
|
|
|
|
|
static JWT_ENCODING_KEY: EncodingKey = EncodingKey::from_secret(JWT_SECRET.as_bytes());
|
|
|
|
|
#[dynamic]
|
|
|
|
|
static JWT_DECODING_KEY: DecodingKey = DecodingKey::from_secret(JWT_SECRET.as_bytes());
|