github.com/wtfutil/wtf@v0.43.0/modules/spotifyweb/settings.go (about) 1 package spotifyweb 2 3 import ( 4 "os" 5 6 "github.com/olebedev/config" 7 "github.com/wtfutil/wtf/cfg" 8 ) 9 10 const ( 11 defaultFocusable = true 12 defaultTitle = "Spotify Web" 13 ) 14 15 type Settings struct { 16 *cfg.Common 17 18 callbackPort string 19 clientID string 20 secretKey string 21 } 22 23 func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { 24 25 settings := Settings{ 26 Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig), 27 28 callbackPort: ymlConfig.UString("callbackPort", "8080"), 29 clientID: ymlConfig.UString("clientID", os.Getenv("SPOTIFY_ID")), 30 secretKey: ymlConfig.UString("secretKey", os.Getenv("SPOTIFY_SECRET")), 31 } 32 33 cfg.ModuleSecret(name, globalConfig, &settings.secretKey).Load() 34 35 return &settings 36 }