mirror of
https://github.com/glanceapp/glance.git
synced 2025-01-10 08:18:33 +01:00
Allow specifying Url from env
This commit is contained in:
parent
2389415071
commit
dd5bec799f
@ -694,7 +694,7 @@ The title used to indicate the site.
|
|||||||
|
|
||||||
`url`
|
`url`
|
||||||
|
|
||||||
The URL which will be requested and its response will determine the status of the site.
|
The URL which will be requested and its response will determine the status of the site. Optionally, you can specify this using an environment variable with the syntax `${VARIABLE_NAME}`.
|
||||||
|
|
||||||
`icon`
|
`icon`
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ func statusCodeToStyle(status int) string {
|
|||||||
type Monitor struct {
|
type Monitor struct {
|
||||||
widgetBase `yaml:",inline"`
|
widgetBase `yaml:",inline"`
|
||||||
Sites []struct {
|
Sites []struct {
|
||||||
Title string `yaml:"title"`
|
Title string `yaml:"title"`
|
||||||
Url string `yaml:"url"`
|
Url OptionalEnvString `yaml:"url"`
|
||||||
IconUrl string `yaml:"icon"`
|
IconUrl string `yaml:"icon"`
|
||||||
SameTab bool `yaml:"same-tab"`
|
SameTab bool `yaml:"same-tab"`
|
||||||
Status *feed.SiteStatus `yaml:"-"`
|
Status *feed.SiteStatus `yaml:"-"`
|
||||||
StatusText string `yaml:"-"`
|
StatusText string `yaml:"-"`
|
||||||
StatusStyle string `yaml:"-"`
|
StatusStyle string `yaml:"-"`
|
||||||
} `yaml:"sites"`
|
} `yaml:"sites"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ func (widget *Monitor) Update(ctx context.Context) {
|
|||||||
requests := make([]*http.Request, len(widget.Sites))
|
requests := make([]*http.Request, len(widget.Sites))
|
||||||
|
|
||||||
for i := range widget.Sites {
|
for i := range widget.Sites {
|
||||||
request, err := http.NewRequest("GET", widget.Sites[i].Url, nil)
|
request, err := http.NewRequest("GET", string(widget.Sites[i].Url), nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
message := fmt.Errorf("failed to create http request for %s: %s", widget.Sites[i].Url, err)
|
message := fmt.Errorf("failed to create http request for %s: %s", widget.Sites[i].Url, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user