-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (33 loc) · 749 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
package main
import (
"context"
"log"
"os"
"github.com/aws/aws-lambda-go/lambda"
alexa "github.com/ericdaugherty/alexa-skills-kit-golang"
"github.com/gregmankes/mta-alexa/handlers"
)
var (
apiKey string
axa alexa.Alexa
)
func Handler(ctx context.Context, requestEnv *alexa.RequestEnvelope) (interface{}, error) {
return axa.ProcessRequest(requestEnv)
}
func main() {
apiKey = os.Getenv("API_KEY")
if apiKey == "" {
log.Fatalf("Error getting the api key")
}
applicationID := os.Getenv("APPLICATION_ID")
if applicationID == "" {
log.Fatalf("Error getting the application ID")
}
axa = alexa.Alexa{
ApplicationID: applicationID,
RequestHandler: &handlers.CommuteTimes{
APIKey: apiKey,
},
}
lambda.Start(Handler)
}