mirror of
https://github.com/cubixle/tuu.git
synced 2026-04-24 23:04:43 +01:00
added sessions and flash storage
This commit is contained in:
18
tuu.go
18
tuu.go
@@ -9,16 +9,26 @@ import (
|
||||
"os/signal"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/sessions"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
IPAddr string
|
||||
Port string
|
||||
Env string
|
||||
IPAddr string
|
||||
Port string
|
||||
Env string
|
||||
SessionName string
|
||||
SessionStore sessions.Store
|
||||
}
|
||||
|
||||
func New(r Router, cfg Config) *App {
|
||||
return &App{router: r, cfg: cfg}
|
||||
cfg.SessionName = "_tuu_session"
|
||||
// TODO: make session secret actual, secret.
|
||||
cfg.SessionStore = sessions.NewCookieStore([]byte("secret"))
|
||||
app := &App{router: r, cfg: cfg}
|
||||
|
||||
r.SetApp(app)
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
type App struct {
|
||||
|
||||
Reference in New Issue
Block a user