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