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