Skip to content

Commit

Permalink
Merge pull request #4 from UpdateHub/default_host
Browse files Browse the repository at this point in the history
Uses default host from updatehub settings
  • Loading branch information
otavio authored Aug 8, 2019
2 parents 4159d01 + 49496a5 commit 8887998
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ package updatehub
import (
"encoding/json"
"fmt"
"net/url"

"github.com/UpdateHub/updatehub/metadata"
"github.com/UpdateHub/updatehub/updatehub"
"github.com/parnurzeal/gorequest"
)

var DefaultHost = updatehub.DefaultSettings.ListenSocket

type Client struct {
}

Expand Down Expand Up @@ -93,5 +96,10 @@ func (c *Client) GetLogs() ([]LogEntry, error) {
}

func buildURL(path string) string {
return fmt.Sprintf("http://localhost:8080/%s", path[1:])
u, err := url.Parse(DefaultHost)
if err != nil {
panic(err)
}

return fmt.Sprintf("http://%s/%s", u.Host, path[1:])
}

0 comments on commit 8887998

Please sign in to comment.