Ver código fonte

Do not parse any yaml if path is empty

Ettore Di Giacinto 3 anos atrás
pai
commit
cc0adff05d
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      pkg/edgevpn/options.go

+ 4 - 0
pkg/edgevpn/options.go

@@ -236,7 +236,11 @@ func GenerateNewConnectionData() (*YAMLConnectionConfig, error) {
 
 func FromYaml(path string) func(cfg *Config) error {
 	return func(cfg *Config) error {
+		if len(path) == 0 {
+			return nil
+		}
 		t := YAMLConnectionConfig{}
+
 		data, err := ioutil.ReadFile(path)
 		if err != nil {
 			return errors.Wrap(err, "reading yaml file")