Explorar el Código

Error message for missing dashboards.json config section, Closes #2256

Torkel Ödegaard hace 10 años
padre
commit
0d856cc135
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. 7 0
      pkg/services/search/handlers.go

+ 7 - 0
pkg/services/search/handlers.go

@@ -1,6 +1,7 @@
 package search
 package search
 
 
 import (
 import (
+	"log"
 	"path/filepath"
 	"path/filepath"
 	"sort"
 	"sort"
 
 
@@ -15,6 +16,12 @@ func Init() {
 	bus.AddHandler("search", searchHandler)
 	bus.AddHandler("search", searchHandler)
 
 
 	jsonIndexCfg, _ := setting.Cfg.GetSection("dashboards.json")
 	jsonIndexCfg, _ := setting.Cfg.GetSection("dashboards.json")
+
+	if jsonIndexCfg == nil {
+		log.Fatal("Config section missing: dashboards.json")
+		return
+	}
+
 	jsonIndexEnabled := jsonIndexCfg.Key("enabled").MustBool(false)
 	jsonIndexEnabled := jsonIndexCfg.Key("enabled").MustBool(false)
 
 
 	if jsonIndexEnabled {
 	if jsonIndexEnabled {