mirror of
https://github.com/volatiletech/authboss.git
synced 2025-09-16 09:06:20 +02:00
Remove state from config, add to authboss type.
This commit is contained in:
@@ -20,12 +20,15 @@ import (
|
||||
// Authboss contains a configuration and other details for running.
|
||||
type Authboss struct {
|
||||
Config
|
||||
Callbacks *Callbacks
|
||||
}
|
||||
|
||||
// New makes a new instance of authboss with a default
|
||||
// configuration.
|
||||
func New() *Authboss {
|
||||
ab := &Authboss{}
|
||||
ab := &Authboss{
|
||||
Callbacks: NewCallbacks(),
|
||||
}
|
||||
ab.Defaults()
|
||||
return ab
|
||||
}
|
||||
|
@@ -107,8 +107,6 @@ type Config struct {
|
||||
// LogWriter is written to when errors occur, as well as on startup to show which modules are loaded
|
||||
// and which routes they registered. By default writes to io.Discard.
|
||||
LogWriter io.Writer
|
||||
// Callbacks is an internal mechanism that can be used by implementers and will be set automatically.
|
||||
Callbacks *Callbacks
|
||||
// Mailer is the mailer being used to send e-mails out. Authboss defines two loggers for use
|
||||
// LogMailer and SMTPMailer, the default is a LogMailer to io.Discard.
|
||||
Mailer Mailer
|
||||
@@ -163,6 +161,5 @@ func (c *Config) Defaults() {
|
||||
c.LockDuration = 5 * time.Hour
|
||||
|
||||
c.LogWriter = NewDefaultLogger()
|
||||
c.Callbacks = NewCallbacks()
|
||||
c.Mailer = LogMailer(ioutil.Discard)
|
||||
}
|
||||
|
Reference in New Issue
Block a user