github.com/wtfutil/wtf@v0.43.0/modules/covid/settings.go (about)

     1  package covid
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = false
    10  	defaultTitle     = "Covid tracker"
    11  )
    12  
    13  // Settings is the struct for this module's settings
    14  type Settings struct {
    15  	*cfg.Common
    16  
    17  	countries []interface{} `help:"Countries (codes) from which to retrieve stats."`
    18  }
    19  
    20  // NewSettingsFromYAML returns the settings from the config yaml file
    21  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    22  
    23  	settings := Settings{
    24  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    25  
    26  		// List of countries to retrieve stats from
    27  		countries: ymlConfig.UList("countries"),
    28  	}
    29  
    30  	return &settings
    31  }