added sessions and flash storage

This commit is contained in:
2018-04-07 14:37:07 +01:00
parent 971f157307
commit b8f8c995c1
10 changed files with 263 additions and 39 deletions

18
tuu.go
View File

@@ -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 {