github.com/wtfutil/wtf@v0.43.0/modules/weatherservices/prettyweather/settings.go (about) 1 package prettyweather 2 3 import ( 4 "github.com/olebedev/config" 5 "github.com/wtfutil/wtf/cfg" 6 ) 7 8 const ( 9 defaultFocusable = false 10 defaultTitle = "Pretty Weather" 11 ) 12 13 type Settings struct { 14 *cfg.Common 15 16 city string 17 unit string 18 view string 19 language string 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 city: ymlConfig.UString("city", "Barcelona"), 27 language: ymlConfig.UString("language", "en"), 28 unit: ymlConfig.UString("unit", "m"), 29 view: ymlConfig.UString("view", "0"), 30 } 31 32 settings.SetDocumentationPath("weather_services/prettyweather") 33 34 return &settings 35 }