use crate::config::GeoffreyAPIConfig; use crate::{Args, Result}; use geoffrey_db::database::Database; use std::sync::Arc; pub struct Context { pub db: Database, pub cfg: GeoffreyAPIConfig, } impl Context { pub fn new(cfg: GeoffreyAPIConfig, args: Args) -> Result> { let ctx = Self { db: Database::new(cfg.server_config.db_path.as_path(), args.force_migration).unwrap(), cfg, }; Ok(Arc::new(ctx)) } }