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

     1  package lunarphase
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = true
    10  	defaultTitle     = "Phase of the Moon"
    11  	dateFormat       = "2006-01-02"
    12  	phaseFormat      = "01-02-2006"
    13  )
    14  
    15  type Settings struct {
    16  	*cfg.Common
    17  
    18  	language       string
    19  	requestTimeout int
    20  }
    21  
    22  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    23  	settings := Settings{
    24  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    25  
    26  		language:       ymlConfig.UString("language", "en"),
    27  		requestTimeout: ymlConfig.UInt("timeout", 30),
    28  	}
    29  
    30  	settings.SetDocumentationPath("lunarphase")
    31  
    32  	return &settings
    33  }