Skip to content

Commit

Permalink
Added support for Redis tls
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Michalski committed Nov 28, 2019
1 parent dcb4efd commit be8705c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_DATABASE=0
#REDIS_PASS=
#REDIS_TLS=true

SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
SLACK_CHANNEL="#my-channel"
6 changes: 5 additions & 1 deletion clean_completed_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ const { forEach } = require('p-iteration')
const REDIS_PORT = Number.parseInt(process.env.REDIS_PORT) || 6379
const REDIS_HOST = process.env.REDIS_HOST || '127.0.0.1'
const REDIS_DATABASE = Number.parseInt(process.env.REDIS_DATABASE) || 0
const REDIS_PASS = process.env.REDIS_PASS
const REDIS_TLS = process.env.REDIS_TLS && `${process.env.REDIS_TLS}` === 'true'

const JOB_AGE = Number.parseInt(process.env.JOB_AGE) || 5000

const REDIS_CONFIG = {
redis: {
port: REDIS_PORT,
host: REDIS_HOST,
db: REDIS_DATABASE
db: REDIS_DATABASE,
password: REDIS_PASS,
tls: REDIS_TLS ? {} : null
}
}

Expand Down
9 changes: 4 additions & 5 deletions retry_failed_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ const REDIS_PORT = Number.parseInt(process.env.REDIS_PORT) || 6379
const REDIS_HOST = process.env.REDIS_HOST || '127.0.0.1'
const REDIS_DATABASE = Number.parseInt(process.env.REDIS_DATABASE) || 0
const REDIS_PASS = process.env.REDIS_PASS
const REDIS_TLS = process.env.REDIS_TLS && `${process.env.REDIS_TLS}` === 'true'

const REDIS_CONFIG = {
redis: {
port: REDIS_PORT,
host: REDIS_HOST,
db: REDIS_DATABASE
db: REDIS_DATABASE,
password: REDIS_PASS,
tls: REDIS_TLS ? {} : null
}
}

if (REDIS_PASS) {
REDIS_CONFIG.redis.password = REDIS_PASS
}

const args = process.argv.slice(2)

if (args.length < 1) {
Expand Down

0 comments on commit be8705c

Please sign in to comment.