Fix up Redis config (#3705)

- Move to private
- Fix validation
- Don't log the URL

Ref #3332
This commit is contained in:
Paul Melnikow
2019-07-12 19:12:49 -04:00
committed by GitHub
parent 84063f8ae3
commit 65afff40d4
3 changed files with 6 additions and 5 deletions

View File

@@ -23,7 +23,6 @@ public:
persistence:
dir: 'PERSISTENCE_DIR'
redisUrl: 'REDIS_URL'
services:
github:
@@ -58,6 +57,7 @@ private:
nexus_user: 'NEXUS_USER'
nexus_pass: 'NEXUS_PASS'
npm_token: 'NPM_TOKEN'
redis_url: 'REDIS_URL'
sentry_dsn: 'SENTRY_DSN'
shields_secret: 'SHIELDS_SECRET'
sl_insight_userUuid: 'SL_INSIGHT_USER_UUID'

View File

@@ -63,7 +63,6 @@ const publicConfigSchema = Joi.object({
},
persistence: {
dir: Joi.string().required(),
redisUrl: optionalUrl,
},
services: {
github: {
@@ -105,6 +104,7 @@ const privateConfigSchema = Joi.object({
nexus_user: Joi.string(),
nexus_pass: Joi.string(),
npm_token: Joi.string(),
redis_url: Joi.string().uri({ scheme: ['redis', 'rediss'] }),
sentry_dsn: Joi.string(),
shields_ips: Joi.array().items(Joi.string().ip()),
shields_secret: Joi.string(),

View File

@@ -28,9 +28,10 @@ class GithubConstellation {
this._debugEnabled = config.service.debug.enabled
this._debugIntervalSeconds = config.service.debug.intervalSeconds
const { redisUrl, dir: persistenceDir } = config.persistence
if (config.persistence.redisUrl) {
log(`RedisTokenPersistence configured with ${redisUrl}`)
const { redis_url: redisUrl } = config.private
const { dir: persistenceDir } = config.persistence
if (redisUrl) {
log('RedisTokenPersistence configured with redisUrl')
this.persistence = new RedisTokenPersistence({
url: redisUrl,
key: 'githubUserTokens',