Skip to main content

conduit_cli/
config.rs

1use serde::{Deserialize, Serialize};
2use std::collections::BTreeMap;
3
4#[derive(Serialize, Deserialize, Debug, Clone)]
5pub struct ConduitConfig {
6    pub name: String,
7    pub mc_version: String,
8    pub loader: String,
9    pub mods: BTreeMap<String, String>,
10    pub settings: Settings,
11    pub gui_settings: GuiSettings,
12}
13
14#[derive(Serialize, Deserialize, Debug, Clone)]
15pub struct Settings {
16    pub auto_update: bool,
17    pub updates_warning: bool,
18    pub tunnel: String,
19}
20
21#[derive(Serialize, Deserialize, Debug, Clone)]
22pub struct GuiSettings {
23    pub auto_wakeup: bool,
24    pub remote_panel: RemotePanel,
25}
26
27#[derive(Serialize, Deserialize, Debug, Clone)]
28pub struct RemotePanel {
29    pub enabled: bool,
30    pub port: String,
31}
32
33impl Default for ConduitConfig {
34    fn default() -> Self {
35        Self {
36            name: "conduit-server".to_string(),
37            mc_version: "1.21.1".to_string(),
38            loader: "neoforge@latest".to_string(),
39            mods: BTreeMap::new(),
40            settings: Settings {
41                auto_update: false,
42                updates_warning: false,
43                tunnel: "playit".to_string(),
44            },
45            gui_settings: GuiSettings {
46                auto_wakeup: true,
47                remote_panel: RemotePanel {
48                    enabled: true,
49                    port: "same".to_string(),
50                },
51            },
52        }
53    }
54}