feat(project): init
This commit is contained in:
23
components/login/libs/redis.ts
Normal file
23
components/login/libs/redis.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import Redis from "ioredis"
|
||||
|
||||
const redisConfig = {
|
||||
port: process.env.NEXT_PUBLIC_REDIS_PORT
|
||||
? Number(process.env.NEXT_PUBLIC_REDIS_PORT)
|
||||
: 6379, // Redis port
|
||||
host: process.env.NEXT_PUBLIC_REDIS_URL || "", // Redis host
|
||||
username: process.env.NEXT_PUBLIC_REDIS_USERNAME || "", // needs Redis >= 6
|
||||
password: process.env.NEXT_PUBLIC_REDIS_PASSWORD || "",
|
||||
db: process.env.NEXT_PUBLIC_REDIS_DB
|
||||
? Number(process.env.NEXT_PUBLIC_REDIS_DB)
|
||||
: 0, // Defaults to 0
|
||||
}
|
||||
|
||||
const redis = new Redis({
|
||||
port: redisConfig.port, // Redis port
|
||||
host: redisConfig.host, // Redis host
|
||||
username: redisConfig.username, // needs Redis >= 6
|
||||
password: redisConfig.password,
|
||||
db: redisConfig.db, // Defaults to 0
|
||||
})
|
||||
|
||||
export default redis
|
||||
Reference in New Issue
Block a user