Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit a935e64

Browse files
committed
Make Client.Config private
Signed-off-by: Arve Knudsen <[email protected]>
1 parent 07f3bbc commit a935e64

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

client.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import (
1717

1818
// Client is a Grafana API client.
1919
type Client struct {
20-
Config
21-
20+
config Config
2221
baseURL url.URL
2322
client *http.Client
2423
}
@@ -50,7 +49,7 @@ func New(baseURL string, cfg Config) (*Client, error) {
5049
}
5150

5251
return &Client{
53-
Config: cfg,
52+
config: cfg,
5453
baseURL: *u,
5554
client: cli,
5655
}, nil
@@ -102,8 +101,8 @@ func (c *Client) newRequest(method, requestPath string, query url.Values, body i
102101
return req, err
103102
}
104103

105-
if c.Config.APIKey != "" {
106-
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.APIKey))
104+
if c.config.APIKey != "" {
105+
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.config.APIKey))
107106
}
108107

109108
if os.Getenv("GF_LOG") != "" {

client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func TestNew_tokenAuth(t *testing.T) {
3131
t.Errorf("expected error: %s; got: %s", expected, c.baseURL.String())
3232
}
3333

34-
if c.Config.APIKey != apiKey {
35-
t.Errorf("expected error: %s; got: %s", apiKey, c.Config.APIKey)
34+
if c.config.APIKey != apiKey {
35+
t.Errorf("expected error: %s; got: %s", apiKey, c.config.APIKey)
3636
}
3737
}
3838

0 commit comments

Comments
 (0)