diff --git a/client.go b/client.go index c31c2b56..aac3955e 100644 --- a/client.go +++ b/client.go @@ -33,6 +33,10 @@ type Config struct { Client *http.Client // OrgID provides an optional organization ID, ignored when using APIKey, BasicAuth defaults to last used org OrgID int64 + + Proxy struct { + APIKey string + } } // New creates a new Grafana client. @@ -110,6 +114,10 @@ func (c *Client) newRequest(method, requestPath string, query url.Values, body i req.Header.Add("X-Grafana-Org-Id", strconv.FormatInt(c.config.OrgID, 10)) } + if c.config.Proxy.APIKey != "" { + req.Header.Add("Proxy-Authorization", fmt.Sprintf("Bearer %s", c.config.Proxy.APIKey)) + } + if os.Getenv("GF_LOG") != "" { if body == nil { log.Printf("request (%s) to %s with no body data", method, url.String())