Chore: Remove bus from plugin proxy api (#44899)

* remove bus from plugin proxy api

* fixing the tests
This commit is contained in:
Serge Zaitsev
2022-02-04 17:35:00 +01:00
committed by GitHub
parent 7a23700e1a
commit 9d654bb6b8
4 changed files with 53 additions and 57 deletions
+3 -3
View File
@@ -6,10 +6,10 @@ import (
"net/http/httputil"
"net/url"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/proxyutil"
@@ -22,10 +22,10 @@ type templateData struct {
// NewApiPluginProxy create a plugin proxy
func NewApiPluginProxy(ctx *models.ReqContext, proxyPath string, route *plugins.Route,
appID string, cfg *setting.Cfg, secretsService secrets.Service) *httputil.ReverseProxy {
appID string, cfg *setting.Cfg, store sqlstore.Store, secretsService secrets.Service) *httputil.ReverseProxy {
director := func(req *http.Request) {
query := models.GetPluginSettingByIdQuery{OrgId: ctx.OrgId, PluginId: appID}
if err := bus.Dispatch(ctx.Req.Context(), &query); err != nil {
if err := store.GetPluginSettingById(ctx.Req.Context(), &query); err != nil {
ctx.JsonApiErr(500, "Failed to fetch plugin settings", err)
return
}