Files
unshell/unshell-server/src/lib.rs
T

41 lines
1.0 KiB
Rust
Raw Normal View History

2025-11-29 14:10:05 -07:00
mod api;
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-16 17:12:00 -07:00
mod modules;
mod server;
2025-12-17 16:40:34 -07:00
pub use server::Server;
use static_init::dynamic;
#[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]
pub static SERVER_CONFIG: unshell_lib::config::PayloadConfig = unshell_lib::config::PayloadConfig {
id: "Server",
components: Vec::new(),
runtime_config: Vec::new(),
};
// 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());