summaryrefslogtreecommitdiff
path: root/cmd/dashboard/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dashboard/main.go')
-rw-r--r--cmd/dashboard/main.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go
index a02ece4..920ccf2 100644
--- a/cmd/dashboard/main.go
+++ b/cmd/dashboard/main.go
@@ -106,8 +106,21 @@ func main() {
}
}
- // Initia lize handlers
- h := handlers.New(db, todoistClient, trelloClient, planToEatClient, googleCalendarClient, cfg)
+ var googleTasksClient api.GoogleTasksAPI
+ if cfg.HasGoogleTasks() {
+ initCtx, cancel := context.WithTimeout(context.Background(), config.GoogleCalendarInitTimeout)
+ var err error
+ googleTasksClient, err = api.NewGoogleTasksClient(initCtx, cfg.GoogleCredentialsFile, cfg.GoogleTasksListID, cfg.Timezone)
+ cancel()
+ if err != nil {
+ log.Printf("Warning: failed to initialize Google Tasks client: %v", err)
+ } else {
+ log.Printf("Google Tasks client initialized for list: %s", cfg.GoogleTasksListID)
+ }
+ }
+
+ // Initialize handlers
+ h := handlers.New(db, todoistClient, trelloClient, planToEatClient, googleCalendarClient, googleTasksClient, cfg)
// Set up router
r := chi.NewRouter()