dashboards as cfg: property path replaces folder

This commit is contained in:
bergquist
2018-01-17 15:48:24 +01:00
parent 183507964c
commit 34d7f8a44f
2 changed files with 37 additions and 7 deletions
@@ -34,9 +34,15 @@ type fileReader struct {
}
func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReader, error) {
path, ok := cfg.Options["folder"].(string)
var path string
path, ok := cfg.Options["path"].(string)
if !ok {
return nil, fmt.Errorf("Failed to load dashboards. folder param is not a string")
path, ok = cfg.Options["folder"].(string)
if !ok {
return nil, fmt.Errorf("Failed to load dashboards. path param is not a string")
}
log.Warn("[Deprecated] The folder property is deprecated. Please use path instead.")
}
if _, err := os.Stat(path); os.IsNotExist(err) {