Expose one rule per source with rule-scoped options
Each registered Source now becomes its own CheckRule (name = source ID) implementing CheckRuleWithOptions, so the host can toggle blacklists individually and the per-source option fields show up under the rule that owns them instead of one flat global option list. Collect honours the host's per-rule enable map (via the SDK's RuleEnabled context helper) and skips the network call for disabled sources entirely, not just their evaluation.
This commit is contained in:
parent
6719e21b51
commit
ce59a976d5
5 changed files with 49 additions and 51 deletions
|
|
@ -9,10 +9,9 @@ import (
|
|||
// Version is overridden at link time by the standalone or plugin entrypoints.
|
||||
var Version = "built-in"
|
||||
|
||||
// Definition assembles the checker definition by aggregating each
|
||||
// registered Source's options into the SDK's audience-grouped layout.
|
||||
// Adding a source automatically adds its option fields here: no edit
|
||||
// to this file needed.
|
||||
// Definition assembles the checker definition. Per-source option fields
|
||||
// live on each per-source rule (CheckRuleWithOptions); the global Options
|
||||
// only carries the shared domain target.
|
||||
func Definition() *sdk.CheckerDefinition {
|
||||
opts := sdk.CheckerOptionsDocumentation{
|
||||
DomainOpts: []sdk.CheckerOptionDocumentation{
|
||||
|
|
@ -23,11 +22,6 @@ func Definition() *sdk.CheckerDefinition {
|
|||
},
|
||||
},
|
||||
}
|
||||
for _, s := range Sources() {
|
||||
o := s.Options()
|
||||
opts.AdminOpts = append(opts.AdminOpts, o.Admin...)
|
||||
opts.UserOpts = append(opts.UserOpts, o.User...)
|
||||
}
|
||||
|
||||
return &sdk.CheckerDefinition{
|
||||
ID: "blacklist",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue