Skip to content

Commit

Permalink
config: expose notification summary toggle
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
hdonnay committed Dec 1, 2020
1 parent dd2e16d commit dc8ba89
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ notifier:
matcher_addr: ""
poll_interval: ""
delivery_interval: ""
disable_summary: false
webhook: null
amqp: null
stomp: null
Expand Down Expand Up @@ -267,6 +268,13 @@ The frequency at which the notifier attempt delivery of created or previously fa
notifications
```

#### &emsp;disable_summary: false
```
A boolean
Controls whether notifications should be summarized to one per manifest or not.
```

#### &emsp;webhook: \<object\>
```
Configures the notifier for webhook delivery
Expand Down
10 changes: 10 additions & 0 deletions config/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ type Notifier struct {
// The frequency at which the notifier attempt delivery of created or previously failed
// notifications
DeliveryInterval string `yaml:"delivery_interval" json:"delivery_interval"`
// DisableSummary disables summarizing vulnerabilities per-manifest.
//
// The default is to summarize any new vulnerabilities to the most severe
// one, in the thought that any additional processing for end-user
// notifications can have policies around severity and fetch a complete
// VulnerabilityReport if it'd like.
//
// For a machine-consumption use case, it may be easier to instead have the
// notifier push all the data.
DisableSummary bool `yaml:"disable_summary" json:"disable_summary"`
// Only one of the following should be provided in the configuration
//
// Configures the notifier for webhook delivery
Expand Down
1 change: 1 addition & 0 deletions initialize/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (i *Init) Services() error {
Client: c,
Migrations: i.conf.Notifier.Migrations,
PollInterval: pInterval,
DisableSummary: i.conf.Notifier.DisableSummary,
Webhook: i.conf.Notifier.Webhook,
AMQP: i.conf.Notifier.AMQP,
STOMP: i.conf.Notifier.STOMP,
Expand Down
2 changes: 2 additions & 0 deletions notifier/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Opts struct {
ConnString string
Matcher matcher.Service
Indexer indexer.Service
DisableSummary bool
Client *http.Client
Webhook *webhook.Config
AMQP *namqp.Config
Expand Down Expand Up @@ -128,6 +129,7 @@ func New(ctx context.Context, opts Opts) (*service, error) {
opts.Matcher,
store,
)
p.NoSummary = opts.DisableSummary
p.Process(ctx, c)
}

Expand Down

0 comments on commit dc8ba89

Please sign in to comment.