Fix parsing yaml

master
kolaente 4 years ago
parent 8f2541c9af
commit fad9c9a27e
Signed by: kolaente
GPG Key ID: F40E70337AB24C9B
  1. 8
      cmd/cluster.go

@ -1,12 +1,12 @@
package cmd
import (
"bufio"
"context"
"git.jfdev.de/JonasFranzDEV/hal/hal"
"git.jfdev.de/JonasFranzDEV/hal/parser"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
)
@ -27,13 +27,13 @@ func runClusterCommand(cmd *cobra.Command, args []string) error {
if stats, err := os.Stat(configFile); err != nil || stats.IsDir() {
return err
}
file, err := os.Open(configFile)
file, err := ioutil.ReadFile(configFile)
if err != nil {
return err
}
scanner := bufio.NewScanner(file)
config := &hal.ClusterConfig{}
if err := yaml.Unmarshal(scanner.Bytes(), config); err != nil {
if err := yaml.Unmarshal(file, config); err != nil {
return err
}

Loading…
Cancel
Save