-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add glob matching configuration (#4)
feat: glob based matching for grant library --------- Signed-off-by: Christopher Phillips <[email protected]>
- Loading branch information
Showing
20 changed files
with
2,013 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
package option | ||
|
||
import "github.com/anchore/grant/grant" | ||
|
||
type Check struct { | ||
Precidence []string `json:"precidence" yaml:"precidence" mapstructure:"precidence"` | ||
DenyLicenses []string `json:"deny-licenses" yaml:"deny-licenses" mapstructure:"deny-licenses"` | ||
AllowLicenses []string `json:"allow-licenses" yaml:"allow-licenses" mapstructure:"allow-licenses"` | ||
DenyLicenses []string `json:"deny-licenses" yaml:"deny-licenses" mapstructure:"deny-licenses"` | ||
} | ||
|
||
func DefaultCheck() Check { | ||
return Check{ | ||
Precidence: []string{"deny", "allow"}, | ||
DenyLicenses: []string{"*"}, | ||
AllowLicenses: []string{}, | ||
DenyLicenses: []string{"*"}, | ||
} | ||
} | ||
|
||
func (c Check) ToPolicy() (*grant.Policy, error) { | ||
return grant.NewPolicy(c.AllowLicenses, c.DenyLicenses) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.