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

     1  package googleanalytics
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = false
    10  	defaultTitle     = "Google Analytics"
    11  )
    12  
    13  type Settings struct {
    14  	*cfg.Common
    15  
    16  	months         int
    17  	secretFile     string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
    18  	viewIds        map[string]interface{}
    19  	enableRealtime bool
    20  }
    21  
    22  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    23  
    24  	settings := Settings{
    25  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    26  
    27  		months:         ymlConfig.UInt("months"),
    28  		secretFile:     ymlConfig.UString("secretFile"),
    29  		viewIds:        ymlConfig.UMap("viewIds"),
    30  		enableRealtime: ymlConfig.UBool("enableRealtime", false),
    31  	}
    32  
    33  	settings.SetDocumentationPath("google/analytics")
    34  
    35  	return &settings
    36  }