Plugins: Refactor plugin settings service (#45967)

* tests passing

* rename and rejig

* move interface to package and rename to Store

* new package

* add import alias
This commit is contained in:
Will Browne
2022-03-03 11:39:15 +01:00
committed by GitHub
parent 6dea7275a6
commit b54b438a24
12 changed files with 209 additions and 210 deletions
+2 -2
View File
@@ -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, store pluginsettings.Service, secretsService secrets.Service) *httputil.ReverseProxy {
appID string, cfg *setting.Cfg, pluginSettingsService pluginsettings.Service, secretsService secrets.Service) *httputil.ReverseProxy {
director := func(req *http.Request) {
query := models.GetPluginSettingByIdQuery{OrgId: ctx.OrgId, PluginId: appID}
if err := store.GetPluginSettingById(ctx.Req.Context(), &query); err != nil {
if err := pluginSettingsService.GetPluginSettingById(ctx.Req.Context(), &query); err != nil {
ctx.JsonApiErr(500, "Failed to fetch plugin settings", err)
return
}