package session import ( "github.com/gorilla/sessions" "os" ) const ( MaxAge = 86400 * 30 IsProd = false ) func New() sessions.Store { key := os.Getenv("SESSION_SECRET") if key == "" { return nil } store := sessions.NewCookieStore([]byte(key)) store.MaxAge(MaxAge) store.Options.Path = "/" store.Options.HttpOnly = true store.Options.Secure = IsProd return store }