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

     1  package gspreadsheets
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = false
    10  	defaultTitle     = "Google Spreadsheets"
    11  )
    12  
    13  type colors struct {
    14  	values string
    15  }
    16  
    17  type Settings struct {
    18  	colors
    19  	*cfg.Common
    20  
    21  	cellAddresses []interface{}
    22  	cellNames     []interface{}
    23  	secretFile    string
    24  	sheetID       string
    25  }
    26  
    27  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    28  
    29  	settings := Settings{
    30  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    31  
    32  		cellNames:  ymlConfig.UList("cells.names"),
    33  		secretFile: ymlConfig.UString("secretFile"),
    34  		sheetID:    ymlConfig.UString("sheetId"),
    35  	}
    36  
    37  	settings.colors.values = ymlConfig.UString("colors.values", "green")
    38  
    39  	settings.SetDocumentationPath("google/spreadsheet")
    40  
    41  	return &settings
    42  }