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