- make cookie time configurable (default: 2 years)

- make cookie https setting configurable (default true in production)
- ensure cookie is set to `path: /` to fix redirect problem
This commit is contained in:
Ulf Gebhardt 2021-01-29 20:45:54 +01:00
parent 309c89ecf8
commit 9bf90bc880
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
2 changed files with 10 additions and 1 deletions

View File

@ -28,6 +28,9 @@ const sentry = {
const options = {
VERSION: process.env.VERSION || pkg.version,
DESCRIPTION: process.env.DESCRIPTION || pkg.description,
// Cookies
COOKIE_EXPIRE_TIME: process.env.COOKIE_EXPIRE_TIME || 730, // Two years by default
COOKIE_HTTPS_ONLY: process.env.COOKIE_HTTPS_ONLY || process.env.NODE_ENV === 'production', // ensure true in production if not set explicitly
}
const CONFIG = {

View File

@ -191,7 +191,13 @@ export default {
apollo: {
tokenName: metadata.COOKIE_NAME, // optional, default: apollo-token
cookieAttributes: {
expires: 1, // optional, default: 7 (days)
expires: CONFIG.COOKIE_EXPIRE_TIME, // optional, default: 7 (days)
/** * Define the path where the cookie is available. Defaults to '/' */
// For some reason this can vary - lets see if setting this helps.
path: '/', // optional
/** * A Boolean indicating if the cookie transmission requires a
* secure protocol (https). Defaults to false. */
secure: CONFIG.COOKIE_HTTPS_ONLY,
},
// includeNodeModules: true, // optional, default: false (this includes graphql-tag for node_modules folder)