Skip to content

Commit

Permalink
Redis session fix (#33)
Browse files Browse the repository at this point in the history
* Redis fixes, remove legacy option

* Version bump for fix
  • Loading branch information
benc-uk authored Oct 11, 2024
1 parent a59a8b4 commit b2cf6a4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
"esbenp.prettier-vscode",
"mikestead.dotenv",
"ms-azuretools.vscode-bicep",
"github.vscode-pull-request-github"
"github.vscode-pull-request-github",
"anweber.vscode-httpyac"
]
}
},

// Optional features, uncomment to enable.
// See https://code.visualstudio.com/docs/remote/containers#_dev-container-features-preview
"features": {
"azure-cli": "latest"
},
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG ARCH=
ARG IMAGE_BASE=20-alpine

FROM ${ARCH}node:$IMAGE_BASE
LABEL Name="Node.js Demo App" Version=4.9.8
LABEL Name="Node.js Demo App" Version=4.9.9
LABEL org.opencontainers.image.source = "https://github.com/benc-uk/nodejs-demoapp"
ENV NODE_ENV production
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
spec:
containers:
- name: redis
image: redis:6
image: redis
ports:
- containerPort: 6379
resources:
Expand Down
10 changes: 5 additions & 5 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nodejs-demoapp",
"description": "Node.js Express app for demos",
"version": "4.9.8",
"version": "4.9.9",
"author": "Ben Coleman",
"engines": {
"node": ">=20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const sessionConfig = {

// Very optional Redis session store - only really needed when running multiple instances
if (process.env.REDIS_SESSION_HOST) {
const redisClient = createRedisClient({ legacyMode: true, url: `redis://${process.env.REDIS_SESSION_HOST}` })
const redisClient = createRedisClient({ url: `redis://${process.env.REDIS_SESSION_HOST}` })

redisClient.connect().catch((err) => {
console.error('### 🚨 Redis session store error:', err.message)
Expand Down

0 comments on commit b2cf6a4

Please sign in to comment.