Commit 0b4a3289 authored by Cristian Maglie's avatar Cristian Maglie

Correcly unserialize additional URL in yaml

parent 1aec2f9f
...@@ -32,6 +32,7 @@ package configs ...@@ -32,6 +32,7 @@ package configs
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/url"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
...@@ -42,7 +43,7 @@ type yamlConfig struct { ...@@ -42,7 +43,7 @@ type yamlConfig struct {
ProxyManualConfig *yamlProxyConfig `yaml:"manual_configs,omitempty"` ProxyManualConfig *yamlProxyConfig `yaml:"manual_configs,omitempty"`
SketchbookPath string `yaml:"sketchbook_path,omitempty"` SketchbookPath string `yaml:"sketchbook_path,omitempty"`
ArduinoDataFolder string `yaml:"arduino_data,omitempty"` ArduinoDataFolder string `yaml:"arduino_data,omitempty"`
BoardsManager struct { BoardsManager *struct {
AdditionalURLS []string `yaml:"additional_urls,omitempty"` AdditionalURLS []string `yaml:"additional_urls,omitempty"`
} `yaml:"board_manager"` } `yaml:"board_manager"`
} }
...@@ -82,6 +83,16 @@ func LoadFromYAML(path string) error { ...@@ -82,6 +83,16 @@ func LoadFromYAML(path string) error {
ProxyPassword = ret.ProxyManualConfig.Password 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 return nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment