github.com/wtfutil/wtf@v0.43.0/modules/cryptocurrency/blockfolio/settings.go (about)

     1  package blockfolio
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = false
    10  	defaultTitle     = "Blockfolio"
    11  )
    12  
    13  type colors struct {
    14  	name  string
    15  	grows string
    16  	drop  string
    17  }
    18  
    19  type Settings struct {
    20  	*cfg.Common
    21  
    22  	colors
    23  
    24  	deviceToken     string
    25  	displayHoldings bool
    26  }
    27  
    28  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    29  
    30  	settings := Settings{
    31  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    32  
    33  		deviceToken:     ymlConfig.UString("device_token"),
    34  		displayHoldings: ymlConfig.UBool("displayHoldings", true),
    35  	}
    36  
    37  	settings.SetDocumentationPath("cryptocurrencies/blockfolio")
    38  
    39  	return &settings
    40  }