11 lines
268 B
Rust
11 lines
268 B
Rust
|
use std::sync::Mutex;
|
||
|
|
||
|
use once_cell::sync::Lazy;
|
||
|
use sled::Db;
|
||
|
|
||
|
pub static DB: Lazy<Mutex<Db>> = Lazy::new(|| {
|
||
|
let db_path = std::env::var("DB_PATH").unwrap_or_else(|_| "user-database.db".to_string());
|
||
|
|
||
|
Mutex::new(sled::open(db_path).unwrap())
|
||
|
});
|