github.com/wtfutil/wtf@v0.43.0/modules/nextbus/settings.go (about) 1 package nextbus 2 3 import ( 4 "github.com/olebedev/config" 5 "github.com/wtfutil/wtf/cfg" 6 ) 7 8 const ( 9 defaultFocusable = false 10 defaultTitle = "nextbus" 11 ) 12 13 // Settings defines the configuration properties for this module 14 type Settings struct { 15 common *cfg.Common 16 17 route string `help:"Route Number of your bus"` 18 agency string `help:"Transit agency of your bus"` 19 stopID string `help:"Your bus stop number"` 20 } 21 22 // NewSettingsFromYAML creates a new settings instance from a YAML config block 23 func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { 24 settings := Settings{ 25 common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig), 26 27 route: ymlConfig.UString("route"), 28 agency: ymlConfig.UString("agency"), 29 stopID: ymlConfig.UString("stopID"), 30 } 31 32 return &settings 33 }