Explorar o código

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

Torkel Ödegaard %!s(int64=10) %!d(string=hai) anos
pai
achega
0d856cc135
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  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 {