Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a way to specify the team key for config fetches (experimental) #1410

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion config/configLoadHelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,25 @@ func getReaderFor(u string) (io.ReadCloser, Format, error) {
}
return r, formatFromFilename(uu.Path), nil
case "http", "https":
resp, err := http.Get(u)
// We need to make an HTTP request but we might need to add the
// x-honeycomb-team header which we get from the environment; we use the
// same header for all requests. This isn't particularly flexible, but
// we think that it's good enough for the experimental stage of this
// feature.
req, err := http.NewRequest("GET", u, nil)
if err != nil {
return nil, FormatUnknown, err
}

// We use a different envvar for the team key because it's not the same
// key used for ingestion. This is not currently documented because it's
// experimental and we might change it later.
key := os.Getenv("HONEYCOMB_CONFIG_KEY")
if key != "" {
req.Header.Set("X-Honeycomb-Team", key)
}

resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, FormatUnknown, err
}
Expand Down