-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 1014 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"flag"
"log"
"os"
"github.com/jvmistica/holiday-planner-go/pkg/suggestion"
)
var (
defaultCalendarID = "en.austrian#holiday@group.v.calendar.google.com"
gcpAPIKey = os.Getenv("GCP_API_KEY")
)
func init() {
gcpAPIKey := os.Getenv("GCP_API_KEY")
if gcpAPIKey == "" {
log.Fatal("missing environment variable GCP_API_KEY")
}
trelloAPIKey := os.Getenv("TRELLO_API_KEY")
if trelloAPIKey == "" {
log.Fatal("missing environment variable TRELLO_API_KEY")
}
trelloAPIToken := os.Getenv("TRELLO_API_TOKEN")
if trelloAPIToken == "" {
log.Fatal("missing environment variable TRELLO_API_TOKEN")
}
}
func main() {
calendarID := flag.String("calendarId", defaultCalendarID, "the calendarID")
start := flag.String("start", "", "the start date")
end := flag.String("end", "", "the end date")
flag.Parse()
if err := suggestion.GenerateSuggestions(gcpAPIKey, *start, *end, *calendarID); err != nil {
log.Fatalf("failed to generate suggestions - %s", err.Error())
}
}