mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Add Slack notifier.
This commit is contained in:
parent
25f81aa80f
commit
d61e31706e
3 changed files with 121 additions and 0 deletions
39
lib/cli.js
39
lib/cli.js
|
@ -617,6 +617,45 @@ program
|
|||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('notify-slack')
|
||||
.description('start Slack notifier')
|
||||
.option('-t, --token <token>'
|
||||
, 'Slack API token (or $SLACK_TOKEN)'
|
||||
, String
|
||||
, process.env.SLACK_TOKEN)
|
||||
.option('-c, --channel #<channel>'
|
||||
, 'Slack channel (or $SLACK_CHANNEL)'
|
||||
, String
|
||||
, process.env.SLACK_CHANNEL)
|
||||
.option('-p, --priority <level>'
|
||||
, 'minimum log level'
|
||||
, Number
|
||||
, logger.Level.IMPORTANT)
|
||||
.option('-s, --connect-sub <endpoint>'
|
||||
, 'sub endpoint'
|
||||
, cliutil.list)
|
||||
.action(function(options) {
|
||||
if (!options.token) {
|
||||
this.missingArgument('--token')
|
||||
}
|
||||
if (!options.channel) {
|
||||
this.missingArgument('--channel')
|
||||
}
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
}
|
||||
|
||||
require('./units/notify/slack')({
|
||||
token: options.token
|
||||
, channel: options.channel
|
||||
, priority: options.priority
|
||||
, endpoints: {
|
||||
sub: options.connectSub
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('log-rethinkdb')
|
||||
.description('start a rethinkdb log recorder')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue