Skip to content

Commit

Permalink
feat: add sessionKey and sessionPath to server options
Browse files Browse the repository at this point in the history
Closes: #55
  • Loading branch information
targos authored and stropitek committed Mar 1, 2017
1 parent 3ce0538 commit 4655fcd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ Type: string
Default: `undefined`
Domain of the session cookie.

##### sessionKey

Type: string
Default: `'roc:sess'`
Key of the session cookie.

##### sessionPath

Type: string
Default: `'/'`
Path of the session cookie.

##### sessionSecure

Type: boolean
Expand Down
5 changes: 5 additions & 0 deletions src/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ module.exports = {
proxyPrefix: '',
publicAddress: 'http://localhost:3000',
keys: ['some secret'],

sessionKey: 'roc:sess',
sessionMaxAge: 24 * 60 * 60 * 1000, // One day
sessionPath: '/',
sessionSecure: false,

allowedOrigins: [],
debugrest: false,
rights: {},
Expand Down
5 changes: 2 additions & 3 deletions src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,13 @@ app.use(cors({

app.keys = config.keys;
app.use(convert(session({
key: 'roc:sess',
key: config.sessionKey,
maxAge: config.sessionMaxAge,
path: '/',
path: config.sessionPath,
domain: config.sessionDomain,
secure: config.sessionSecure,
httpOnly: true,
signed: true

}, app)));
app.use(passport.initialize());
app.use(passport.session());
Expand Down

0 comments on commit 4655fcd

Please sign in to comment.