mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(cli): make repo url a parameter
this is a quick hack to support repo url as parameter. Will refactor later
This commit is contained in:
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
var IoHelper m.IoUtil = IoUtilImp{}
|
||||
|
||||
func ListAllPlugins() (m.PluginRepo, error) {
|
||||
res, _ := goreq.Request{Uri: "https://raw.githubusercontent.com/grafana/grafana-plugin-repository/master/repo.json"}.Do()
|
||||
func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
|
||||
res, _ := goreq.Request{Uri: repoUrl}.Do()
|
||||
|
||||
var resp m.PluginRepo
|
||||
err := res.Body.FromJsonTo(&resp)
|
||||
@@ -59,16 +59,16 @@ func RemoveInstalledPlugin(pluginPath, id string) error {
|
||||
return IoHelper.RemoveAll(path.Join(pluginPath, id))
|
||||
}
|
||||
|
||||
func GetPlugin(id string) (m.Plugin, error) {
|
||||
resp, err := ListAllPlugins()
|
||||
func GetPlugin(pluginId, repoUrl string) (m.Plugin, error) {
|
||||
resp, err := ListAllPlugins(repoUrl)
|
||||
if err != nil {
|
||||
}
|
||||
|
||||
for _, i := range resp.Plugins {
|
||||
if i.Id == id {
|
||||
if i.Id == pluginId {
|
||||
return i, nil
|
||||
}
|
||||
}
|
||||
|
||||
return m.Plugin{}, errors.New("could not find plugin named \"" + id + "\"")
|
||||
return m.Plugin{}, errors.New("could not find plugin named \"" + pluginId + "\"")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user