mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Have the modules set their own titles If no title is specified, use this title, rather than default to name
32 lines
658 B
Go
32 lines
658 B
Go
package twitter
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/olebedev/config"
|
|
"github.com/wtfutil/wtf/cfg"
|
|
)
|
|
|
|
const defaultTitle = "Twitter"
|
|
|
|
type Settings struct {
|
|
common *cfg.Common
|
|
|
|
bearerToken string
|
|
count int
|
|
screenNames []interface{}
|
|
}
|
|
|
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
|
|
|
settings := Settings{
|
|
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
|
|
|
bearerToken: ymlConfig.UString("bearerToken", os.Getenv("WTF_TWITTER_BEARER_TOKEN")),
|
|
count: ymlConfig.UInt("count", 5),
|
|
screenNames: ymlConfig.UList("screenName"),
|
|
}
|
|
|
|
return &settings
|
|
}
|