mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
Feature: add cron setting for the ldap settings (#16673)
* Feature: add cron setting for the ldap settings * Move ldap configuration read to special function * Introduce cron setting (no docs for it yet, pending approval) * Chore: address code review comments
This commit is contained in:
parent
8ca5add4ec
commit
78cd9058a3
@ -363,6 +363,9 @@ enabled = false
|
||||
config_file = /etc/grafana/ldap.toml
|
||||
allow_sign_up = true
|
||||
|
||||
# LDAP backround sync (Enterprise only)
|
||||
sync_cron = @hourly
|
||||
|
||||
#################################### SMTP / Emailing #####################
|
||||
[smtp]
|
||||
enabled = false
|
||||
|
@ -39,7 +39,5 @@ frontend
|
||||
ldap-daniel
|
||||
editors
|
||||
ldap-editors
|
||||
|
||||
|
||||
no groups
|
||||
ldap-viewer
|
||||
|
@ -166,6 +166,7 @@ var (
|
||||
// LDAP
|
||||
LdapEnabled bool
|
||||
LdapConfigFile string
|
||||
LdapSyncCron string
|
||||
LdapAllowSignup = true
|
||||
|
||||
// QUOTA
|
||||
@ -877,14 +878,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ldapSec := iniFile.Section("auth.ldap")
|
||||
LdapEnabled = ldapSec.Key("enabled").MustBool(false)
|
||||
LdapConfigFile, err = valueAsString(ldapSec, "config_file", "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
LdapAllowSignup = ldapSec.Key("allow_sign_up").MustBool(true)
|
||||
|
||||
alerting := iniFile.Section("alerting")
|
||||
AlertingEnabled = alerting.Key("enabled").MustBool(true)
|
||||
ExecuteAlerts = alerting.Key("execute_alerts").MustBool(true)
|
||||
@ -917,6 +910,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
||||
cfg.PluginsEnableAlpha = true
|
||||
}
|
||||
|
||||
cfg.readLDAPConfig()
|
||||
cfg.readSessionConfig()
|
||||
cfg.readSmtpSettings()
|
||||
cfg.readQuotaSettings()
|
||||
@ -981,6 +975,14 @@ type RemoteCacheOptions struct {
|
||||
ConnStr string
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readLDAPConfig() {
|
||||
ldapSec := cfg.Raw.Section("auth.ldap")
|
||||
LdapEnabled = ldapSec.Key("enabled").MustBool(false)
|
||||
LdapConfigFile = ldapSec.Key("config_file").String()
|
||||
LdapAllowSignup = ldapSec.Key("allow_sign_up").MustBool(true)
|
||||
LdapSyncCron = ldapSec.Key("sync_cron").String()
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readSessionConfig() {
|
||||
sec, _ := cfg.Raw.GetSection("session")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user