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

     1  package rollbar
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = true
    10  	defaultTitle     = "Rollbar"
    11  )
    12  
    13  type Settings struct {
    14  	*cfg.Common
    15  
    16  	accessToken    string `help:"Your Rollbar project access token (Only needs read capabilities)."`
    17  	activeOnly     bool   `help:"Only show items that are active." optional:"true"`
    18  	assignedToName string `help:"Set this to your username if you only want to see items assigned to you." optional:"true"`
    19  	count          int    `help:"How many items you want to see. 100 is max." optional:"true"`
    20  	projectName    string `help:"This is used to create a link to the item."`
    21  	projectOwner   string `help:"This is used to create a link to the item."`
    22  }
    23  
    24  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    25  
    26  	settings := Settings{
    27  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    28  
    29  		accessToken:    ymlConfig.UString("accessToken"),
    30  		activeOnly:     ymlConfig.UBool("activeOnly", false),
    31  		assignedToName: ymlConfig.UString("assignedToName"),
    32  		count:          ymlConfig.UInt("count", 10),
    33  		projectName:    ymlConfig.UString("projectName", "Items"),
    34  		projectOwner:   ymlConfig.UString("projectOwner"),
    35  	}
    36  
    37  	cfg.ModuleSecret(name, globalConfig, &settings.accessToken).Load()
    38  
    39  	return &settings
    40  }