|
@@ -118,6 +118,10 @@ type SiteStatusRequest struct {
|
|
DefaultURL string `yaml:"url"`
|
|
DefaultURL string `yaml:"url"`
|
|
CheckURL string `yaml:"check-url"`
|
|
CheckURL string `yaml:"check-url"`
|
|
AllowInsecure bool `yaml:"allow-insecure"`
|
|
AllowInsecure bool `yaml:"allow-insecure"`
|
|
|
|
+ BasicAuth struct {
|
|
|
|
+ Username string `yaml:"username"`
|
|
|
|
+ Password string `yaml:"password"`
|
|
|
|
+ } `yaml:"basic-auth"`
|
|
}
|
|
}
|
|
|
|
|
|
type siteStatus struct {
|
|
type siteStatus struct {
|
|
@@ -141,6 +145,10 @@ func fetchSiteStatusTask(statusRequest *SiteStatusRequest) (siteStatus, error) {
|
|
}, nil
|
|
}, nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if statusRequest.BasicAuth.Username != "" || statusRequest.BasicAuth.Password != "" {
|
|
|
|
+ request.SetBasicAuth(statusRequest.BasicAuth.Username, statusRequest.BasicAuth.Password)
|
|
|
|
+ }
|
|
|
|
+
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
|
defer cancel()
|
|
defer cancel()
|
|
request = request.WithContext(ctx)
|
|
request = request.WithContext(ctx)
|