mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
Admin page for bill wit iron-session (#13)
This commit is contained in:
17
lib/session.ts
Normal file
17
lib/session.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { withIronSession } from 'next-iron-session'
|
||||
|
||||
const SESSION_SECRET =
|
||||
process.env.SESSION_SECRET || 'dev-env-default-secret-991823723'
|
||||
|
||||
export default function withSession(handler) {
|
||||
return withIronSession(handler, {
|
||||
password: SESSION_SECRET,
|
||||
cookieName: 'pfadi-bussle-cookie',
|
||||
cookieOptions: {
|
||||
// the next line allows to use the session in non-https environements like
|
||||
// Next.js dev mode (http://localhost:3000)
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
path: '/admin',
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user