mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
Admin: Add support to configure default admin email (#54363)
This commit is contained in:
parent
687b0b1726
commit
39102c6656
@ -247,6 +247,9 @@ admin_user = admin
|
||||
# default admin password, can be changed before first start of grafana, or in profile settings
|
||||
admin_password = admin
|
||||
|
||||
# default admin email, created on startup
|
||||
admin_email = admin@localhost
|
||||
|
||||
# used for signing
|
||||
secret_key = SW2YcwTIb9zpOOhoPsMm
|
||||
|
||||
|
@ -247,6 +247,9 @@
|
||||
# default admin password, can be changed before first start of grafana, or in profile settings
|
||||
;admin_password = admin
|
||||
|
||||
# default admin email, created on startup
|
||||
;admin_email = admin@localhost
|
||||
|
||||
# used for signing
|
||||
;secret_key = SW2YcwTIb9zpOOhoPsMm
|
||||
|
||||
|
@ -208,7 +208,7 @@ func (ss *SQLStore) ensureMainOrgAndAdminUser() error {
|
||||
ss.log.Debug("Creating default admin user")
|
||||
if _, err := ss.createUser(ctx, sess, user.CreateUserCommand{
|
||||
Login: ss.Cfg.AdminUser,
|
||||
Email: ss.Cfg.AdminUser + "@localhost",
|
||||
Email: ss.Cfg.AdminEmail,
|
||||
Password: ss.Cfg.AdminPassword,
|
||||
IsAdmin: true,
|
||||
}); err != nil {
|
||||
|
@ -293,6 +293,7 @@ type Cfg struct {
|
||||
BasicAuthEnabled bool
|
||||
AdminUser string
|
||||
AdminPassword string
|
||||
AdminEmail string
|
||||
|
||||
// AWS Plugin Auth
|
||||
AWSAllowedAuthProviders []string
|
||||
@ -1254,6 +1255,7 @@ func readSecuritySettings(iniFile *ini.File, cfg *Cfg) error {
|
||||
cfg.DisableInitAdminCreation = security.Key("disable_initial_admin_creation").MustBool(false)
|
||||
cfg.AdminUser = valueAsString(security, "admin_user", "")
|
||||
cfg.AdminPassword = valueAsString(security, "admin_password", "")
|
||||
cfg.AdminEmail = valueAsString(security, "admin_email", fmt.Sprintf("%s@localhost", cfg.AdminUser))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user