mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Add service document support for aggregator
This commit is contained in:
parent
e37fe68b34
commit
141acc802e
2 changed files with 79 additions and 5 deletions
|
|
@ -39,6 +39,8 @@ type provider struct {
|
|||
Rate *float64 `toml:"rate"`
|
||||
Insecure *bool `toml:"insecure"`
|
||||
Categories *[]string `toml:"categories"`
|
||||
// ServiceDocument incidates if we should create a service.json document.
|
||||
ServiceDocument *bool `toml:"create_service_document"`
|
||||
}
|
||||
|
||||
type config struct {
|
||||
|
|
@ -72,11 +74,23 @@ type config struct {
|
|||
// RemoteValidator configures an optional remote validation.
|
||||
RemoteValidatorOptions *csaf.RemoteValidatorOptions `toml:"remote_validator"`
|
||||
|
||||
// ServiceDocument incidates if we should create a service.json document.
|
||||
ServiceDocument bool `toml:"create_service_document"`
|
||||
|
||||
keyMu sync.Mutex
|
||||
key *crypto.Key
|
||||
keyErr error
|
||||
}
|
||||
|
||||
// serviceDocument tells if we should generate a service document for a
|
||||
// given provider.
|
||||
func (p *provider) serviceDocument(c *config) bool {
|
||||
if p.ServiceDocument != nil {
|
||||
return *p.ServiceDocument
|
||||
}
|
||||
return c.ServiceDocument
|
||||
}
|
||||
|
||||
// runAsMirror determines if the aggregator should run in mirror mode.
|
||||
func (c *config) runAsMirror() bool {
|
||||
return c.Aggregator.Category != nil &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue