syft/syft/pkg/cataloger/java/options.go
Colm O hEigeartaigh 9fa11f2339
Wire though maven-url to java config (#2291)
Signed-off-by: Colm O hEigeartaigh <coheigea@apache.org>
2023-11-06 09:08:03 -05:00

37 lines
736 B
Go

package java
const MavenBaseURL = "https://repo1.maven.org/maven2"
type CatalogerOpts struct {
UseNetwork bool
MavenURL string
MaxParentRecursiveDepth int
}
func (j CatalogerOpts) WithUseNetwork(input bool) CatalogerOpts {
j.UseNetwork = input
return j
}
func (j CatalogerOpts) WithMavenURL(input string) CatalogerOpts {
if input != "" {
j.MavenURL = input
}
return j
}
func (j CatalogerOpts) WithMaxParentRecursiveDepth(input int) CatalogerOpts {
if input > 0 {
j.MaxParentRecursiveDepth = input
}
return j
}
func DefaultCatalogerOpts() CatalogerOpts {
return CatalogerOpts{
UseNetwork: false,
MavenURL: MavenBaseURL,
MaxParentRecursiveDepth: 5,
}
}