Skip to content

Commit

Permalink
Correcly unserialize additional URL in yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jul 4, 2018
1 parent 1aec2f9 commit 0b4a328
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion configs/yaml_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ package configs
import (
"fmt"
"io/ioutil"
"net/url"

"github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v2"
Expand All @@ -42,7 +43,7 @@ type yamlConfig struct {
ProxyManualConfig *yamlProxyConfig `yaml:"manual_configs,omitempty"`
SketchbookPath string `yaml:"sketchbook_path,omitempty"`
ArduinoDataFolder string `yaml:"arduino_data,omitempty"`
BoardsManager struct {
BoardsManager *struct {
AdditionalURLS []string `yaml:"additional_urls,omitempty"`
} `yaml:"board_manager"`
}
Expand Down Expand Up @@ -82,6 +83,16 @@ func LoadFromYAML(path string) error {
ProxyPassword = ret.ProxyManualConfig.Password
}
}
if ret.BoardsManager != nil {
for _, rawurl := range ret.BoardsManager.AdditionalURLS {
url, err := url.Parse(rawurl)
if err != nil {
logrus.WithError(err).Warn("Error parsing config")
continue
}
BoardManagerAdditionalUrls = append(BoardManagerAdditionalUrls, url)
}
}
return nil
}

Expand Down

0 comments on commit 0b4a328

Please sign in to comment.