mirror of
https://github.com/volatiletech/authboss.git
synced 2024-11-28 08:58:38 +02:00
23 lines
682 B
Go
23 lines
682 B
Go
|
package defaults
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
|
||
|
"github.com/volatiletech/authboss"
|
||
|
)
|
||
|
|
||
|
// SetDefaultCore creates instances of all the default pieces
|
||
|
//
|
||
|
// Assumes you have a ViewRenderer already set.
|
||
|
func SetDefaultCore(config *authboss.Config, useUsername bool) {
|
||
|
logger := NewLogger(os.Stdout)
|
||
|
|
||
|
config.Core.Router = NewRouter()
|
||
|
config.Core.ErrorHandler = ErrorHandler{LogWriter: logger}
|
||
|
config.Core.Responder = &Responder{Renderer: config.Core.ViewRenderer}
|
||
|
config.Core.Redirector = &Redirector{Renderer: config.Core.ViewRenderer, FormValueName: "redir"}
|
||
|
config.Core.BodyReader = NewHTTPFormReader(useUsername)
|
||
|
config.Core.Mailer = NewLogMailer(os.Stdout)
|
||
|
config.Core.Logger = logger
|
||
|
}
|