mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:53:10 +08:00
Auth: Separate anonymous settings to its own struct (#97791)
separate anonymous settings to its own struct
This commit is contained in:
21
pkg/setting/setting_anonymous.go
Normal file
21
pkg/setting/setting_anonymous.go
Normal file
@ -0,0 +1,21 @@
|
||||
package setting
|
||||
|
||||
type AnonymousSettings struct {
|
||||
Enabled bool
|
||||
OrgName string
|
||||
OrgRole string
|
||||
HideVersion bool
|
||||
DeviceLimit int64
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readAnonymousSettings() {
|
||||
anonSection := cfg.Raw.Section("auth.anonymous")
|
||||
|
||||
anonSettings := AnonymousSettings{}
|
||||
anonSettings.Enabled = anonSection.Key("enabled").MustBool(false)
|
||||
anonSettings.OrgName = valueAsString(anonSection, "org_name", "")
|
||||
anonSettings.OrgRole = valueAsString(anonSection, "org_role", "")
|
||||
anonSettings.HideVersion = anonSection.Key("hide_version").MustBool(false)
|
||||
anonSettings.DeviceLimit = anonSection.Key("device_limit").MustInt64(0)
|
||||
cfg.Anonymous = anonSettings
|
||||
}
|
Reference in New Issue
Block a user