mirror of
https://github.com/grafana/grafana.git
synced 2026-06-10 09:01:30 -04:00
26 lines
621 B
Go
26 lines
621 B
Go
package setting
|
|
|
|
import (
|
|
"gopkg.in/ini.v1"
|
|
)
|
|
|
|
const maxNestedFolderDepth = 7
|
|
const DefaultMaxNestedFolderDepth = 4
|
|
|
|
func maxDeptFolderSettings(iniFile *ini.File) int {
|
|
if iniFile == nil {
|
|
return DefaultMaxNestedFolderDepth
|
|
}
|
|
|
|
folderSection := iniFile.Section("folder")
|
|
cfgMaxNestedFolderDepth := folderSection.Key("max_nested_folder_depth").MustInt(DefaultMaxNestedFolderDepth)
|
|
if cfgMaxNestedFolderDepth > maxNestedFolderDepth {
|
|
cfgMaxNestedFolderDepth = maxNestedFolderDepth
|
|
}
|
|
|
|
if cfgMaxNestedFolderDepth <= 0 {
|
|
cfgMaxNestedFolderDepth = DefaultMaxNestedFolderDepth
|
|
}
|
|
|
|
return cfgMaxNestedFolderDepth
|
|
}
|