mirror of
https://github.com/Xevion/todoist-late-reset.git
synced 2025-12-09 10:09:00 -06:00
clean up with new api
This commit is contained in:
@@ -19,10 +19,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
client *api.SyncClient
|
||||
redisURL string
|
||||
cronSchedule string
|
||||
tzLocation *time.Location
|
||||
client *api.SyncClient
|
||||
tzLocation *time.Location
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -31,13 +29,6 @@ func init() {
|
||||
if err != nil {
|
||||
fmt.Println(".env file not loaded")
|
||||
}
|
||||
|
||||
// Load timezone
|
||||
tzLocation, err = time.LoadLocation("America/Chicago")
|
||||
if err != nil {
|
||||
fmt.Println("Error loading location:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// primary is the main function that will be run by the scheduler
|
||||
@@ -60,14 +51,20 @@ func primary() error {
|
||||
}
|
||||
|
||||
func main() {
|
||||
redisURL = os.Getenv("REDIS_URL")
|
||||
cronSchedule = os.Getenv("CRON_SCHEDULE")
|
||||
|
||||
client = api.NewSyncClient(os.Getenv("TODOIST_API_KEY"))
|
||||
|
||||
// redisURL := os.Getenv("REDIS_URL")
|
||||
cronSchedule := os.Getenv("CRON_SCHEDULE")
|
||||
// opt, _ := redis.ParseURL(redisURL)
|
||||
// client := redis.NewClient(opt)
|
||||
|
||||
// Load timezone
|
||||
tzLocation, err := time.LoadLocation("America/Chicago")
|
||||
if err != nil {
|
||||
fmt.Println("Error loading location:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
client = api.NewSyncClient(os.Getenv("TODOIST_API_KEY"))
|
||||
|
||||
// create a scheduler
|
||||
s, err := gocron.NewScheduler(gocron.WithLocation(tzLocation))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user