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

     1  package config
     2  
     3  import (
     4  	"github.com/nextlinux/gosbom/gosbom/source"
     5  	"github.com/nextlinux/gosbom/internal/file"
     6  	"github.com/spf13/viper"
     7  )
     8  
     9  type fileContents struct {
    10  	Cataloger          catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"`
    11  	SkipFilesAboveSize int64            `yaml:"skip-files-above-size" json:"skip-files-above-size" mapstructure:"skip-files-above-size"`
    12  	Globs              []string         `yaml:"globs" json:"globs" mapstructure:"globs"`
    13  }
    14  
    15  func (cfg fileContents) loadDefaultValues(v *viper.Viper) {
    16  	v.SetDefault("file-contents.cataloger.enabled", catalogerEnabledDefault)
    17  	v.SetDefault("file-contents.cataloger.scope", source.SquashedScope)
    18  	v.SetDefault("file-contents.skip-files-above-size", 1*file.MB)
    19  	v.SetDefault("file-contents.globs", []string{})
    20  }
    21  
    22  func (cfg *fileContents) parseConfigValues() error {
    23  	return cfg.Cataloger.parseConfigValues()
    24  }