diff --git a/internal/helper/config.go b/internal/helper/config.go index 312e494..17e97ac 100644 --- a/internal/helper/config.go +++ b/internal/helper/config.go @@ -11,17 +11,21 @@ import ( func ParseConfig(filename string) ChronoTomato.Config { var config ChronoTomato.Config + if strings.HasPrefix(filename, "~/") { dirname, _ := os.UserHomeDir() filename = filepath.Join(dirname, filename[2:]) } + yamlFile, err := os.ReadFile(filename) if err != nil { log.Fatal("Error opening config file!", "reason", err) } + err = yaml.Unmarshal(yamlFile, &config) if err != nil { log.Fatalf("Unmarshal: %v", err) } + return config } diff --git a/internal/websocket/receive.go b/internal/websocket/receive.go index 3e96ca9..1474ccd 100644 --- a/internal/websocket/receive.go +++ b/internal/websocket/receive.go @@ -11,7 +11,6 @@ import ( var Done = make(chan struct{}) func ProcessServerMessages(conn *websocket.Conn, channel chan<- GoTomato.ServerMessage) { - var serverMessage GoTomato.ServerMessage defer close(Done)