mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 10:27:45 +02:00
Merge pull request #367 from ejsadiarin/dev
feat(monitor): add basic-auth feature for protected sites
This commit is contained in:
commit
4d6600b0a3
@ -1476,6 +1476,7 @@ Properties for each site:
|
|||||||
| allow-insecure | boolean | no | false |
|
| allow-insecure | boolean | no | false |
|
||||||
| same-tab | boolean | no | false |
|
| same-tab | boolean | no | false |
|
||||||
| alt-status-codes | array | no | |
|
| alt-status-codes | array | no | |
|
||||||
|
| basic-auth | object | no | |
|
||||||
|
|
||||||
`title`
|
`title`
|
||||||
|
|
||||||
@ -1524,6 +1525,16 @@ alt-status-codes:
|
|||||||
- 403
|
- 403
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`basic-auth`
|
||||||
|
|
||||||
|
HTTP Basic Authentication credentials for protected sites.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
basic-auth:
|
||||||
|
usename: your-username
|
||||||
|
password: your-password
|
||||||
|
```
|
||||||
|
|
||||||
### Releases
|
### Releases
|
||||||
Display a list of latest releases for specific repositories on Github, GitLab, Codeberg or Docker Hub.
|
Display a list of latest releases for specific repositories on Github, GitLab, Codeberg or Docker Hub.
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user