1pub mod addons;
2pub mod auth;
3pub mod cache;
4pub mod cli;
5pub mod config;
6pub mod paths;
7pub mod templates;
8pub mod utils;
9
10use std::{
11 path::PathBuf,
12 sync::{Arc, Mutex},
13};
14
15use reqwest::Client;
16
17use crate::paths::OxidePaths;
18
19pub type CleanupState = Arc<Mutex<Option<PathBuf>>>;
20
21pub struct AppContext {
22 pub paths: OxidePaths,
23 pub client: Client,
24 pub cleanup_state: CleanupState,
25 pub backend_url: String,
26 pub frontend_url: String,
27}
28
29impl AppContext {
30 pub fn new(paths: OxidePaths, client: Client, cleanup_state: CleanupState) -> Self {
31 let backend_url = std::env::var("OXIDE_BACKEND_URL")
32 .unwrap_or_else(|_| "https://oxide-server.onrender.com".to_string());
33 let frontend_url = std::env::var("OXIDE_FRONTEND_URL")
34 .unwrap_or_else(|_| "https://oxide-cli.vercel.app".to_string());
35 Self {
36 paths,
37 client,
38 cleanup_state,
39 backend_url,
40 frontend_url,
41 }
42 }
43}