Closed robinbraemer closed 2 months ago
example program that can now rewrite the gate config seamlessly:
package main import ( liteconfig "go.minekube.com/gate/pkg/edition/java/lite/config" "go.minekube.com/gate/pkg/gate/config" "go.minekube.com/gate/pkg/util/configutil" "gopkg.in/yaml.v3" "os" ) func main() { cfg := config.Config{} f, err := os.ReadFile("config.yml") if err != nil { panic(err) } err = yaml.Unmarshal(f, &cfg) if err != nil { panic(err) } cfg.Editions = config.Editions{} // empty it cfg.Config.Lite.Routes = append(cfg.Config.Lite.Routes, liteconfig.Route{ Host: configutil.SingleOrMulti[string]{"localhost"}, Backend: []string{"localhost"}, }) out, err := yaml.Marshal(cfg) if err != nil { panic(err) } err = os.WriteFile("config.yml", out, 0644) if err != nil { panic(err) } }
8510b15
View logs
example program that can now rewrite the gate config seamlessly: