|
|
|
@ -7,12 +7,13 @@ import ( |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
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"` |
|
|
|
|
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"` |
|
|
|
|
Headers []ApiPluginHeader `json:"headers"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ApiPlugin struct { |
|
|
|
@ -20,6 +21,11 @@ type ApiPlugin struct { |
|
|
|
|
Routes []*ApiPluginRoute `json:"routes"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ApiPluginHeader struct { |
|
|
|
|
Name string `json:"name"` |
|
|
|
|
Content string `json:"content"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (app *ApiPlugin) Load(decoder *json.Decoder, pluginDir string) error { |
|
|
|
|
if err := decoder.Decode(&app); err != nil { |
|
|
|
|
return err |
|
|
|
|