ShaneK / Matador

Front-end web interface for Bull Job Manager
MIT License
98 stars 51 forks source link

Basic auth example #39

Open krazyjakee opened 7 years ago

krazyjakee commented 7 years ago

I would like to password protect the interface. I tried to copy the http-auth and express method but it didn't work. How can I achieve this?

krazyjakee commented 7 years ago

Sorry, I should include the example...

const app = require('bull-ui/app')({
  redis: {
    host: process.env.REDIS_HOST,
    port: process.env.REDIS_PORT
  }
})

const auth = require('http-auth')
const basic = auth.basic({
  realm: 'SUPER SECRET STUFF'
}, (username, password, callback) => {
  callback(username == 'admin' && password == 'password');
})
app.use(auth.connect(basic))
app.listen(1337, () => {
  console.log('bull-ui started listening on port 1337');
})