Skip to content

Commit

Permalink
Fetch public nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Dec 20, 2018
1 parent 70c89a9 commit 06d8d11
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ func Initialize(name string) {
}

cfgPath := filepath.Join(home, "."+name+".json")

GetPublicNodes()
fmt.Println(cfgPath)
}
32 changes: 32 additions & 0 deletions internal/config/publicnodes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package config

import (
"encoding/json"
"io/ioutil"
"net/http"
)

type PublicNode struct {
Url string `json:"url"`
Maintainer string `json:"maintainer"`
Company string `json:"company"`
Website string `json:"website"`
}

func GetPublicNodes() []PublicNode {
resp, err := http.Get("https://github.com/raw/OpenDroneMap/CloudODM/master/public_nodes.json")
if err != nil {
return nil
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil
}

nodes := []PublicNode{}
json.Unmarshal(body, &nodes)

return nil
}

0 comments on commit 06d8d11

Please sign in to comment.