github.com/wtfutil/wtf@v0.43.0/modules/ipaddresses/ipapi/settings.go (about) 1 package ipapi 2 3 import ( 4 "github.com/olebedev/config" 5 "github.com/wtfutil/wtf/cfg" 6 ) 7 8 const ( 9 defaultFocusable = false 10 defaultTitle = "IP API" 11 ) 12 13 type colors struct { 14 name string 15 value string 16 } 17 18 type Settings struct { 19 colors 20 *cfg.Common 21 args []interface{} `help:"Defines what data to display and the order." values:"'ip', 'isp', 'as', 'asName', 'district', 'city', 'region', 'regionName', 'country', 'countryCode', 'continent', 'continentCode', 'coordinates', 'postalCode', 'currency', 'organization', 'timezone' and/or 'reverseDNS'"` 22 } 23 24 func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { 25 settings := Settings{ 26 Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig), 27 28 args: ymlConfig.UList("args"), 29 } 30 31 settings.colors.name = ymlConfig.UString("colors.name", "red") 32 settings.colors.value = ymlConfig.UString("colors.value", "white") 33 settings.SetDocumentationPath("ipaddress/ipapi") 34 35 return &settings 36 }