瀏覽代碼

Allow using env variables in custom API URL

Svilen Markov 7 月之前
父節點
當前提交
bacb607d90
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      internal/widget/custom-api.go

+ 2 - 2
internal/widget/custom-api.go

@@ -14,7 +14,7 @@ import (
 
 type CustomApi struct {
 	widgetBase       `yaml:",inline"`
-	URL              string                       `yaml:"url"`
+	URL              OptionalEnvString            `yaml:"url"`
 	Template         string                       `yaml:"template"`
 	Frameless        bool                         `yaml:"frameless"`
 	Headers          map[string]OptionalEnvString `yaml:"headers"`
@@ -42,7 +42,7 @@ func (widget *CustomApi) Initialize() error {
 
 	widget.compiledTemplate = compiledTemplate
 
-	req, err := http.NewRequest(http.MethodGet, widget.URL, nil)
+	req, err := http.NewRequest(http.MethodGet, widget.URL.String(), nil)
 	if err != nil {
 		return err
 	}