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

     1  package urlcheck
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = false
    10  	defaultTitle     = "URLcheck"
    11  )
    12  
    13  type Settings struct {
    14  	Common *cfg.Common
    15  
    16  	requestTimeout int      `help:"Max Request duration in seconds"`
    17  	urls           []string `help:"A list of URL to check"`
    18  }
    19  
    20  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    21  	settings := Settings{
    22  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    23  
    24  		requestTimeout: ymlConfig.UInt("timeout", 30),
    25  	}
    26  	settings.urls = cfg.ParseAsMapOrList(ymlConfig, "urls")
    27  	return &settings
    28  }