Documentation
¶
Overview ¶
Package bootstrap gates creation of the first user behind a one-time setup token.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SetupToken is the operator-supplied token. When empty a random one is
// generated at startup (if no user exists yet) and logged once.
SetupToken string
// OpenSignupAfterFirstUser reopens ordinary signup once the first user exists.
OpenSignupAfterFirstUser bool
// SuppressSetupTokenLog stops the generated token being logged; read it
// with TheAuth.SetupToken instead.
SuppressSetupTokenLog bool
// OnFirstUser runs after the first user is created, for example to
// grant the super admin role. Errors are logged and do not fail signup.
OnFirstUser func(ctx context.Context, user *models.User) error
}
Config closes public signup and gates creation of the first user behind a one-time setup token (the storage must implement UserCountStorage). Password signup needs the token while no user exists. Magic-link signup cannot present a token, so the first admin signs up with a password. OnFirstUser grants the admin role.