github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/internal/config/pkg.go (about)

     1  package config
     2  
     3  import (
     4  	"github.com/nextlinux/gosbom/gosbom/pkg/cataloger"
     5  	"github.com/spf13/viper"
     6  )
     7  
     8  type pkg struct {
     9  	Cataloger               catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"`
    10  	SearchUnindexedArchives bool             `yaml:"search-unindexed-archives" json:"search-unindexed-archives" mapstructure:"search-unindexed-archives"`
    11  	SearchIndexedArchives   bool             `yaml:"search-indexed-archives" json:"search-indexed-archives" mapstructure:"search-indexed-archives"`
    12  }
    13  
    14  func (cfg pkg) loadDefaultValues(v *viper.Viper) {
    15  	cfg.Cataloger.loadDefaultValues(v)
    16  	c := cataloger.DefaultSearchConfig()
    17  	v.SetDefault("package.search-unindexed-archives", c.IncludeUnindexedArchives)
    18  	v.SetDefault("package.search-indexed-archives", c.IncludeIndexedArchives)
    19  }
    20  
    21  func (cfg *pkg) parseConfigValues() error {
    22  	return cfg.Cataloger.parseConfigValues()
    23  }