Skip to content

Commit

Permalink
update addon api to support non-domain bind address
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed Jul 23, 2017
1 parent f48dee8 commit 3734011
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions system/addon/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type QueryOptions db.QueryOptions

// ContentAll retrives all items from the HTTP API within the provided namespace
func ContentAll(namespace string) []byte {
host := db.ConfigCache("domain").(string)
addr := db.ConfigCache("bind_addr").(string)
port := db.ConfigCache("http_port").(string)
endpoint := "http://%s:%s/api/contents?type=%s&count=-1"
URL := fmt.Sprintf(endpoint, host, port, namespace)
URL := fmt.Sprintf(endpoint, addr, port, namespace)

j, err := Get(URL)
if err != nil {
Expand All @@ -35,10 +35,10 @@ func ContentAll(namespace string) []byte {
// Query retrieves a set of content from the HTTP API based on options
// and returns the total number of content in the namespace and the content
func Query(namespace string, opts QueryOptions) []byte {
host := db.ConfigCache("domain").(string)
addr := db.ConfigCache("bind_addr").(string)
port := db.ConfigCache("http_port").(string)
endpoint := "http://%s:%s/api/contents?type=%s&count=%d&offset=%d&order=%s"
URL := fmt.Sprintf(endpoint, host, port, namespace, opts.Count, opts.Offset, opts.Order)
URL := fmt.Sprintf(endpoint, addr, port, namespace, opts.Count, opts.Offset, opts.Order)

j, err := Get(URL)
if err != nil {
Expand Down

0 comments on commit 3734011

Please sign in to comment.