Skip to content

Commit

Permalink
fix: env
Browse files Browse the repository at this point in the history
  • Loading branch information
rosendolu committed Apr 14, 2024
1 parent 5620e61 commit 4cc890c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.2.0",
"configurations": [
{
"command": "npm run dev",
"command": "nvm use && npm run dev",
"name": "Run npm run dev",
"request": "launch",
"type": "node-terminal"
Expand Down
4 changes: 2 additions & 2 deletions app/common/constant.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = {
isProdEnv: !/dev/.test(process.env.NODE_ENV || ''),
isProdEnv: !/dev/i.test(process.env.NODE_ENV || ''),
koaSessionConfig: {
maxAge: 864e5 * 7, // seven days
httpOnly: true /** (boolean) httpOnly or not (default true) */,
signed: true /** (boolean) signed or not (default true) */,
rolling: true /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */,
renew: true /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/,
secure: this.isProdEnv ? true : false /** (boolean) secure cookie*/,
secure: false /** (boolean) secure cookie*/,
},
};
1 change: 1 addition & 0 deletions app/router/root.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = router => {
const { visitCount, uid, lastVisit } = ctx.session;
ctx.body = {
message: `Last visit ${dayjs().to(dayjs(lastVisit))}!`,
visitCount: visitCount,
lastVisit: lastVisit,
uid,
serverTime: utils.timestamp(),
Expand Down

0 comments on commit 4cc890c

Please sign in to comment.