Skip to content

Commit

Permalink
Check if URL already contains remote write path before appending it
Browse files Browse the repository at this point in the history
Signed-off-by: Douglas Camata <[email protected]>
  • Loading branch information
douglascamata committed May 28, 2024
1 parent 29695d9 commit 65d3b8c
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ func generateHubInfoSecret(client client.Client, obsNamespace string,
}
}

obsApiURL := url.URL{
Host: obsAPIHost,
Path: operatorconfig.ObservatoriumAPIRemoteWritePath,
if !strings.HasSuffix(obsAPIHost, operatorconfig.ObservatoriumAPIRemoteWritePath) {
obsAPIHost += operatorconfig.ObservatoriumAPIRemoteWritePath
}

obsApiURL, err := url.Parse(obsAPIHost)
if err != nil {
return nil, err
}
if !obsApiURL.IsAbs() {
obsApiURL.Scheme = "https"
Expand Down

0 comments on commit 65d3b8c

Please sign in to comment.