mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 18:31:24 +02:00
Update implementation
This commit is contained in:
parent
5b45751c67
commit
dac0d15e78
@ -28,10 +28,6 @@ type monitorWidget struct {
|
||||
StatusText string `yaml:"-"`
|
||||
StatusStyle string `yaml:"-"`
|
||||
AltStatusCodes []int `yaml:"alt-status-codes"`
|
||||
BasicAuth struct {
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
} `yaml:"basic-auth"`
|
||||
} `yaml:"sites"`
|
||||
Style string `yaml:"style"`
|
||||
ShowFailingOnly bool `yaml:"show-failing-only"`
|
||||
@ -49,10 +45,6 @@ func (widget *monitorWidget) update(ctx context.Context) {
|
||||
|
||||
for i := range widget.Sites {
|
||||
requests[i] = widget.Sites[i].SiteStatusRequest
|
||||
if widget.Sites[i].BasicAuth.Username != "" || widget.Sites[i].BasicAuth.Password != "" {
|
||||
requests[i].Username = widget.Sites[i].BasicAuth.Username
|
||||
requests[i].Password = widget.Sites[i].BasicAuth.Password
|
||||
}
|
||||
}
|
||||
|
||||
statuses, err := fetchStatusForSites(requests)
|
||||
@ -126,8 +118,10 @@ type SiteStatusRequest struct {
|
||||
DefaultURL string `yaml:"url"`
|
||||
CheckURL string `yaml:"check-url"`
|
||||
AllowInsecure bool `yaml:"allow-insecure"`
|
||||
Username string `yaml:"-"`
|
||||
Password string `yaml:"-"`
|
||||
BasicAuth struct {
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
} `yaml:"basic-auth"`
|
||||
}
|
||||
|
||||
type siteStatus struct {
|
||||
@ -151,8 +145,8 @@ func fetchSiteStatusTask(statusRequest *SiteStatusRequest) (siteStatus, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
if statusRequest.Username != "" || statusRequest.Password != "" {
|
||||
request.SetBasicAuth(statusRequest.Username, statusRequest.Password)
|
||||
if statusRequest.BasicAuth.Username != "" || statusRequest.BasicAuth.Password != "" {
|
||||
request.SetBasicAuth(statusRequest.BasicAuth.Username, statusRequest.BasicAuth.Password)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user