Просмотр исходного кода

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

Torkel Ödegaard 10 лет назад
Родитель
Сommit
0d856cc135
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      pkg/services/search/handlers.go

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

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