update endpoint for azure

This commit is contained in:
Pascal Fischer
2024-02-08 17:36:22 +01:00
parent 72f44d7fd7
commit 7bec002070
+8 -1
View File
@@ -5,7 +5,14 @@ import (
)
func detectAzure() string {
resp, err := hc.Get("http://169.254.169.254/metadata/v1/InstanceInfo")
req, err := http.NewRequest("GET", "http://169.254.169.254/metadata/instance?api-version=2021-02-01", nil)
if err != nil {
return ""
}
req.Header.Set("Metadata", "true")
resp, err := hc.Do(req)
if err == nil && resp.StatusCode == http.StatusOK {
return "Microsoft Azure"
}