Last active
October 17, 2020 17:27
-
-
Save miladr0/7de3d8df19de66f3c5101b001c40e4e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Redis from 'ioredis'; | |
const PORT = process.env.REDIS_PORT; | |
const HOST = process.env.REDIS_HOST; | |
const client = new Redis(PORT, HOST); | |
const subscriber = new Redis(PORT, HOST); | |
const opts = { | |
createClient(type) { | |
switch (type) { | |
case 'client': | |
return client; | |
case 'subscriber': | |
return subscriber; | |
default: | |
return new Redis(PORT, HOST); | |
} | |
}, | |
}; | |
export default opts; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment