Skip to content

Commit e087ab1

Browse files
committed
Enable Redis based on env variable
1 parent 7e0470e commit e087ab1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ [email protected]
77
EMAIL_SMTP_DOMAIN_MAILGUN=myproject.com
88
EMAIL_SMTP_API_MAILGUN=123456
99
FRONTEND_URL=http://localhost:8080
10+
USE_REDIS=false
1011
REDIS_HOST=127.0.0.1
1112
REDIS_PORT=6379

server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ if (process.env.NODE_ENV === 'development') {
1818
app.use(morgan('dev'))
1919
}
2020

21-
// Redis cache enabled only for production
22-
if (process.env.NODE_ENV === 'production') {
21+
// Redis cache enabled by env variable
22+
if (process.env.USE_REDIS === 'true') {
2323
const getExpeditiousCache = require('express-expeditious')
2424
const cache = getExpeditiousCache({
2525
namespace: 'expresscache',

0 commit comments

Comments
 (0)