func generateConfig() error { defaultConfig := map[string]interface{}{ "user": "******", "screenBaseName": "msct-", "ramMin": "2048", "ramMax": "4096", "paths": map[string]interface{}{ "root": "/opt/minecraft/", "jarFile": "server.jar", }, "startTmuxAttached": "false", "javaParams": "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:ParallelGCThreads=2 -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90", "debug": "false", "keepAliveFreq": "30", } yaml, err := config.RenderYaml(defaultConfig) if err != nil { return err } err = ioutil.WriteFile("/etc/msct.conf", []byte(yaml), 0644) if err != nil { return err } return nil }
func handleConfigList(cli *cli.Context, cfg *config.Config) error { yaml, err := config.RenderYaml(cfg) if err != nil { return ExitCode{ UnknownError, fmt.Sprintf("Unable to render config: %v", err), } } fmt.Println(yaml) return nil }