mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Simplify the inclusion of the Common config settings into each module
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -15,7 +15,8 @@ const (
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
apiKey string `help:"Your finnhub API token."`
|
||||
symbols []string `help:"An array of stocks symbols (i.e. AAPL, MSFT)"`
|
||||
}
|
||||
@@ -24,7 +25,7 @@ type Settings struct {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_FINNHUB_API_KEY"))),
|
||||
symbols: utils.ToStrs(ymlConfig.UList("symbols")),
|
||||
|
||||
@@ -20,7 +20,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
Client: NewClient(settings.symbols, settings.apiKey),
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user