Skip to content

Commit a08bc61

Browse files
committed
Fikser keyPrefix
1 parent c45eaf4 commit a08bc61

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.env.prod-local

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ INNLOGGINGSSTATUS_URL=http://localhost:8095/nav-dekoratoren-api/auth
1111
REVALIDATOR_PROXY_ORIGIN=http://localhost:3002
1212
XP_ORIGIN=http://localhost:8080
1313
IS_FAILOVER_INSTANCE='false'
14-
BUILD_ID=prodLocal
1514
RELEASE_TAG=prodLocal
1615
ASSET_PREFIX=http://localhost:3000
1716
TELEMETRY_URL=http://localhost:12347/collect

server/cache/redis.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@ type ConstructorProps = {
2323
export class RedisCache {
2424
private readonly client: ReturnType<typeof createClient>;
2525
private readonly ttl: number;
26-
private readonly keyPrefix = process.env.BUILD_ID;
26+
private readonly keyPrefix: string;
2727

2828
constructor({ ttl }: ConstructorProps) {
29-
const options = clientOptions[process.env.ENV];
29+
const env = process.env.ENV;
30+
const options = clientOptions[env];
3031

3132
if (!options) {
3233
throw Error(
33-
`Redis client options were not defined for the current app environment ${process.env.ENV}`
34+
`Redis client options were not defined for the current app environment: ${env}`
3435
);
3536
}
3637

3738
this.ttl = ttl;
39+
this.keyPrefix = process.env.BUILD_ID;
3840

3941
this.client = createClient(options)
4042
.on('connect', () => {
@@ -53,9 +55,7 @@ export class RedisCache {
5355
console.error('Redis client error: ', err);
5456
});
5557

56-
console.log(
57-
`Created redis client with url ${process.env.REDIS_URI_PAGECACHE_DEV1}`
58-
);
58+
console.log(`Created redis client with url ${options.url}`);
5959
}
6060

6161
public async init() {

0 commit comments

Comments
 (0)