ci: redis credentials only on production
Some checks failed
Build and Push Docker Image / build (push) Blocked by required conditions
Build and Push Docker Image / tests (push) Has been cancelled

This commit is contained in:
Lars Hampe 2024-11-05 15:59:03 +01:00
parent 15425cdc32
commit 94cf57cfda

View File

@ -1,9 +1,15 @@
import { createClient } from 'redis'
export const redis = createClient({
password: import.meta.env.REDIS_PASSWORD,
url: import.meta.env.REDIS_URL,
})
const getRedisOptions = () => {
if (import.meta.env.NODE_ENV !== 'production') {
return {
password: import.meta.env.REDIS_PASSWORD,
url: import.meta.env.REDIS_URL,
}
}
return {}
}
export const redis = createClient(getRedisOptions())
redis.on('error', (err) => console.log('Redis Client Error', err))
await redis.connect()