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:
co-authored by
Andres Martinez Gotor
parent
ea243b536c
commit
702e22806c
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user