mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
* WTF-781 Switch Todoist IDs from `int` to `string` On platforms that convert an `int` to `int32`, like the Raspberry Pi, an `int` is not large enough to store Todoist project IDs. Using a `string` ensures this never becomes a problem. Fixes #781 Signed-off-by: Chris Cummer <chriscummer@me.com>
35 lines
885 B
Go
35 lines
885 B
Go
package todoist
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/olebedev/config"
|
|
"github.com/wtfutil/wtf/cfg"
|
|
"github.com/wtfutil/wtf/utils"
|
|
)
|
|
|
|
const (
|
|
defaultFocusable = true
|
|
defaultTitle = "Todoist"
|
|
)
|
|
|
|
// Settings defines the configuration properties for this module
|
|
type Settings struct {
|
|
common *cfg.Common
|
|
|
|
apiKey string `help:"Your Todoist API key"`
|
|
projects []uint
|
|
}
|
|
|
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
|
settings := Settings{
|
|
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
|
|
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_TODOIST_TOKEN"))),
|
|
projects: utils.IntsToUints(utils.ToInts(ymlConfig.UList("projects"))),
|
|
}
|
|
|
|
return &settings
|
|
}
|