Skip to content

Commit 077c26c

Browse files
committed
fix: ignore empty registry URLs
Some GKE users might have set this to an empty string, which leads to this service to fail during startup.
1 parent 9ad9c4d commit 077c26c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const amqp = require('amqplib')
22
const redis = require('redis')
3+
const isEmpty = require('lodash').isEmpty
34

45
const env = require('./lib/env')
56
const {parseRegistryUrl, checkFollower, startChanges} = require('./lib/follow')
7+
const isNotEmpty = (value) => !isEmpty(value)
68

79
;(async () => {
810
const conn = await amqp.connect(env.AMQP_URL)
@@ -12,7 +14,7 @@ const {parseRegistryUrl, checkFollower, startChanges} = require('./lib/follow')
1214
})
1315
const client = redis.createClient(env.REDIS_URL)
1416

15-
env.REGISTRY_URLS.forEach(registryUrl => {
17+
env.REGISTRY_URLS.filter(isNotEmpty).forEach(registryUrl => {
1618
const registry = parseRegistryUrl(registryUrl)
1719
const start = startChanges.bind(null, {
1820
channel,

0 commit comments

Comments
 (0)