Store your Minecraft configs with your other dotfiles, and load it automatically.

init: get started, basic basic config loading

Changed files
+49
config
+3
config.toml
···
···
+
[fabric.mods]
+
sodium = "AANobbMI"
+
fabric-api = "P7dR8mSH"
+23
config/config.go
···
···
+
package config
+
+
import (
+
"os"
+
+
"github.com/BurntSushi/toml"
+
)
+
+
type (
+
Config struct {
+
Fabric Loader `toml:fabric`
+
}
+
Loader struct {
+
Mods map[string]string `toml:mods`
+
}
+
)
+
+
func LoadConfig() (Config) {
+
file, _ := os.ReadFile("config.toml")
+
var config Config
+
toml.Decode(string(file), &config)
+
return config
+
}
+5
go.mod
···
···
+
module potassium.sh/dot-mining
+
+
go 1.25.4
+
+
require github.com/BurntSushi/toml v1.5.0 // indirect
+2
go.sum
···
···
+
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
+
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
+16
main.go
···
···
+
package main
+
+
import (
+
"fmt"
+
+
"potassium.sh/dot-mining/config"
+
)
+
+
+
+
func main() {
+
config := config.LoadConfig()
+
for modName, modID := range config.Fabric.Mods {
+
fmt.Printf("- %s: %s\n", modName, modID)
+
}
+
}