Commit c4a0ec84 by Anthony Woods

get apiPlugins working again.

parent 7a26d309
package plugins
import (
"encoding/json"
"strings"
"github.com/grafana/grafana/pkg/models"
)
type ApiPluginRoute struct {
Path string `json:"path"`
Method string `json:"method"`
ReqSignedIn bool `json:"reqSignedIn"`
ReqGrafanaAdmin bool `json:"reqGrafanaAdmin"`
ReqRole models.RoleType `json:"reqRole"`
Url string `json:"url"`
}
type ApiPlugin struct {
PluginBase
Routes []*ApiPluginRoute `json:"routes"`
}
func (app *ApiPlugin) Load(decoder *json.Decoder, pluginDir string) error {
if err := decoder.Decode(&app); err != nil {
return err
}
ApiPlugins[app.Id] = app
return nil
}
...@@ -73,3 +73,12 @@ func NewEnabledPlugins() EnabledPlugins { ...@@ -73,3 +73,12 @@ func NewEnabledPlugins() EnabledPlugins {
Apps: make([]*AppPlugin, 0), Apps: make([]*AppPlugin, 0),
} }
} }
func (app *ApiPlugin) Load(decoder *json.Decoder, pluginDir string) error {
if err := decoder.Decode(&app); err != nil {
return err
}
ApiPlugins[app.Id] = app
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment