-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
32 lines (26 loc) · 960 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
package main
import (
"net/http"
"os"
"github.com/Sirupsen/logrus"
"github.com/jipiboily/forwardlytics/handlers"
_ "github.com/jipiboily/forwardlytics/integrations/drift"
_ "github.com/jipiboily/forwardlytics/integrations/drip"
_ "github.com/jipiboily/forwardlytics/integrations/intercom"
_ "github.com/jipiboily/forwardlytics/integrations/mixpanel"
_ "github.com/jipiboily/forwardlytics/errortracker"
)
func main() {
if os.Getenv("FORWARDLYTICS_API_KEY") == "" {
logrus.Fatal("You need to set FORWARDLYTICS_API_KEY")
}
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
http.Handle("/identify", handlers.AuthMiddleware(http.HandlerFunc(handlers.Identify)))
http.Handle("/track", handlers.AuthMiddleware(http.HandlerFunc(handlers.Track)))
http.Handle("/page", handlers.AuthMiddleware(http.HandlerFunc(handlers.Page)))
logrus.Infof("Forwardlytics started on port %v", port)
logrus.Fatal(http.ListenAndServe(":"+port, nil))
}