Plugins Proxy: Allow using {{ .URL }} inside "routes" section in plugin.json (#80858)

Signed-off-by: Slach <bloodjazman@gmail.com>
Co-authored-by: Andres Martinez Gotor <andres.mgotor@gmail.com>
This commit is contained in:
Eugene Klimov
2024-02-02 09:23:07 +01:00
committed by GitHub
co-authored by Andres Martinez Gotor
parent ea243b536c
commit 702e22806c
4 changed files with 34 additions and 1 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ import (
type DSInfo struct {
ID int64
Updated time.Time
URL string
JSONData map[string]any
DecryptedSecureJSONData map[string]string
}
@@ -24,8 +25,8 @@ type DSInfo struct {
func ApplyRoute(ctx context.Context, req *http.Request, proxyPath string, route *plugins.Route,
ds DSInfo, cfg *setting.Cfg) {
proxyPath = strings.TrimPrefix(proxyPath, route.Path)
data := templateData{
URL: ds.URL,
JsonData: ds.JSONData,
SecureJsonData: ds.DecryptedSecureJSONData,
}