Skip to content

A self-hosted dashboard that puts all your feeds in one place

Allow specifying Url from env

Svilen Markovdd5bec799f50
diff --git a/docs/configuration.md b/docs/configuration.md
index 0022c82..a697b41 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -694,7 +694,7 @@ The title used to indicate the site.
`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`
diff --git a/internal/widget/monitor.go b/internal/widget/monitor.go
index 3375ae5..90a984f 100644
--- a/internal/widget/monitor.go
+++ b/internal/widget/monitor.go
@@ -46,13 +46,13 @@ func statusCodeToStyle(status int) string {
type Monitor struct {
widgetBase `yaml:",inline"`
Sites []struct {
- Title string `yaml:"title"`
- Url string `yaml:"url"`
- IconUrl string `yaml:"icon"`
- SameTab bool `yaml:"same-tab"`
- Status *feed.SiteStatus `yaml:"-"`
- StatusText string `yaml:"-"`
- StatusStyle string `yaml:"-"`
+ Title string `yaml:"title"`
+ Url OptionalEnvString `yaml:"url"`
+ IconUrl string `yaml:"icon"`
+ SameTab bool `yaml:"same-tab"`
+ Status *feed.SiteStatus `yaml:"-"`
+ StatusText string `yaml:"-"`
+ StatusStyle string `yaml:"-"`
} `yaml:"sites"`
}
@@ -66,7 +66,7 @@ func (widget *Monitor) Update(ctx context.Context) {
requests := make([]*http.Request, len(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 {
message := fmt.Errorf("failed to create http request for %s: %s", widget.Sites[i].Url, err)