Skip to content

Commit 1b44b86

Browse files
baseplate-adminstabldev
authored andcommitted
FINALLY FIX REDIS
Update redis.ts Update node.js.yml Update redis.ts Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update node.js.yml Update redis.ts Update node.js.yml Update node.js.yml Update redis.ts Update redis.ts Update node.js.yml Update node.js.yml Update redis.ts
1 parent 5f7a970 commit 1b44b86

2 files changed

Lines changed: 27 additions & 13 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@ on:
77
push:
88
branches:
99
- "*"
10-
pull_request:
11-
branches:
12-
- "*"
1310

1411
jobs:
1512
build:
1613
runs-on: ubuntu-latest
1714

15+
# Service containers to run with `runner-job`
16+
services:
17+
# Label used to access the service container
18+
redis:
19+
# Docker Hub image
20+
image: redis
21+
# Set health checks to wait until redis has started
22+
options: >-
23+
--health-cmd "redis-cli ping"
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
ports:
28+
# Maps port 6379 on service container to the host
29+
- 6379:6379
30+
1831
strategy:
1932
matrix:
2033
node-version: [22.x]
@@ -36,4 +49,6 @@ jobs:
3649
run: |
3750
npm run build
3851
npm run build:node
39-
npm run build:static
52+
53+
# env:
54+
# REDIS_URL: "redis://localhost:6379"

src/lib/server/redis.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { createClient } from "redis";
22
import { env } from "$env/dynamic/private";
33

4-
export const redis_client = createClient({
5-
url: env.REDIS_URL
6-
});
7-
8-
redis_client.on("error", function (err) {
9-
throw new Error(err);
10-
});
11-
12-
await redis_client.connect();
4+
export const redis_client = await createClient({
5+
url: env.REDIS_URL ?? undefined,
6+
socket: {
7+
tls: env.REDIS_TLS === "true"
8+
}
9+
})
10+
.on("error", (err) => console.log(err))
11+
.connect();

0 commit comments

Comments
 (0)