github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/pkg/cataloger/javascript/config.go (about)

     1  package javascript
     2  
     3  const npmBaseURL = "https://registry.npmjs.org"
     4  
     5  type CatalogerConfig struct {
     6  	SearchRemoteLicenses bool   `json:"search-remote-licenses" yaml:"search-remote-licenses" mapstructure:"search-remote-licenses"`
     7  	NPMBaseURL           string `json:"npm-base-url" yaml:"npm-base-url" mapstructure:"npm-base-url"`
     8  }
     9  
    10  func DefaultCatalogerConfig() CatalogerConfig {
    11  	return CatalogerConfig{
    12  		SearchRemoteLicenses: false,
    13  		NPMBaseURL:           npmBaseURL,
    14  	}
    15  }
    16  
    17  func (j CatalogerConfig) WithSearchRemoteLicenses(input bool) CatalogerConfig {
    18  	j.SearchRemoteLicenses = input
    19  	return j
    20  }
    21  
    22  func (j CatalogerConfig) WithNpmBaseURL(input string) CatalogerConfig {
    23  	if input != "" {
    24  		j.NPMBaseURL = input
    25  	}
    26  	return j
    27  }