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

     1  package pocket
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = true
    10  	defaultTitle     = "Pocket"
    11  )
    12  
    13  type Settings struct {
    14  	*cfg.Common
    15  
    16  	consumerKey string
    17  	requestKey  *string
    18  	accessToken *string
    19  }
    20  
    21  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    22  	settings := Settings{
    23  		Common:      cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    24  		consumerKey: ymlConfig.UString("consumerKey"),
    25  	}
    26  
    27  	cfg.ModuleSecret(name, globalConfig, &settings.consumerKey).Load()
    28  
    29  	return &settings
    30  }