示例#1
0
func runCommand(command func(commandLine CommandLine) error) func(context *cli.Context) {
	return func(context *cli.Context) {

		cmd := &contextCommandLine{context}
		if err := command(cmd); err != nil {
			log.Error("\nError: ")
			log.Errorf("%s\n\n", err)

			cmd.ShowHelp()
			os.Exit(1)
		} else {
			log.Info("\nRestart grafana after installing plugins . <service grafana-server restart>\n\n")
		}
	}
}
示例#2
0
文件: main.go 项目: VoiSmart/grafana
func getGrafanaPluginDir() string {
	currentOS := runtime.GOOS
	defaultNix := "/var/lib/grafana/plugins"

	if currentOS == "windows" {
		return "../data/plugins"
	}

	pwd, err := os.Getwd()

	if err != nil {
		log.Error("Could not get current path. using default")
		return defaultNix
	}

	if isDevenvironment(pwd) {
		return "../data/plugins"
	}

	return defaultNix
}