Skip to content

Commit

Permalink
Add option to specify a registry
Browse files Browse the repository at this point in the history
PR #9 from @raaymax
  • Loading branch information
iaincollins authored Dec 24, 2018
2 parents 2f34a25 + e162d8b commit 89cd1d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const dockerCommand = process.env.DOCKER || '/usr/bin/docker'
const token = process.env.TOKEN || ''
const username = process.env.USERNAME || ''
const password = process.env.PASSWORD || ''
const registry = process.env.REGISTRY || ''

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
Expand All @@ -39,7 +40,7 @@ app.post('/webhook/:token', (req, res) => {
const service = services[image].service

// Make sure we are logged in to be able to pull the image
child_process.exec(`${dockerCommand} login -u "${username}" -p "${password}"`,
child_process.exec(`${dockerCommand} login -u "${username}" -p "${password}" ${registry}`,
(error, stdout, stderr) => {
if (error) return console.error(error)

Expand All @@ -63,4 +64,4 @@ app.all('*', (req, res) => {
app.listen(process.env.PORT, err => {
if (err) throw err
console.log(`Listening for webhooks on http://localhost:${process.env.PORT}/webhook/${token}`)
})
})

0 comments on commit 89cd1d9

Please sign in to comment.