hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-29 02:51:16 +0200
committerhachem <im@hachem.wtf>2026-08-29 02:51:16 +0200
commitf60177934a18daea3b24a37cf109bb2c7bfaaa72 (patch)
tree7b6e20dd7b5c94b9c176e75497c5045dcb589075 /internal/config
parente56d21fa04450d118f76347a96a12d1d5477958f (diff)
feat: nicer ui
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
new file mode 100644
index 0000000..35842a1
--- /dev/null
+++ b/internal/config/config.go
@@ -0,0 +1,45 @@
+package config
+
+import (
+ "encoding/json"
+ "os"
+ "path/filepath"
+)
+
+type Config struct {
+ ChannelID string `json:"channel_id"`
+ CheckIntervalMinutes int `json:"check_interval_minutes"`
+ MinecraftVersion string `json:"minecraft_version"`
+ FabricLoaderVersion string `json:"fabric_loader_version"`
+ LoaderMetaVersion string `json:"loader_meta_version"`
+ JavaPath string `json:"java_path"`
+ ServerLocation string `json:"server_location"`
+ BackupLocation string `json:"backup_location"`
+ MergePreCommand string `json:"merge_pre_command"`
+ MergePostCommand string `json:"merge_post_command"`
+ ModrinthMods []string `json:"modrinth_mods"`
+}
+
+const Dir = "config"
+
+func Path() string {
+ return filepath.Join(Dir, "config.json")
+}
+
+func APIPath() string {
+ return filepath.Join(Dir, "api.json")
+}
+
+func Load() (*Config, error) {
+ data, err := os.ReadFile(Path())
+ if err != nil {
+ return nil, err
+ }
+
+ var c Config
+ if err := json.Unmarshal(data, &c); err != nil {
+ return nil, err
+ }
+
+ return &c, nil
+}