-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (39 loc) · 1.24 KB
/
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
43
44
45
46
47
// Copyright 2014 Bowery, Inc.
package main
import (
"flag"
"fmt"
"github.com/Bowery/gopackages/aws"
"github.com/Bowery/gopackages/config"
"github.com/Bowery/gopackages/etcdb"
"github.com/Bowery/gopackages/gcloud"
"github.com/Bowery/gopackages/web"
"github.com/Bowery/slack"
"github.com/timonv/pusher"
)
var (
awsC, _ = aws.NewClient(config.S3AccessKey, config.S3SecretKey)
gcloudC *gcloud.Client
pusherC *pusher.Client
slackC *slack.Client
db *etcdb.Client
env string
port string
)
func main() {
flag.StringVar(&env, "env", "development", "Mode to run Kenmare in.")
flag.StringVar(&port, "port", ":3000", "Port to listen on.")
flag.Parse()
gcloudC, _ = gcloud.NewClient(config.GoogleCloudProjectID, config.GoogleCloudEmail, []byte(config.GoogleCloudPrivateKey))
pusherC = pusher.NewClient(config.PusherAppID, config.PusherKey, config.PusherSecret)
slackC = slack.NewClient(config.SlackToken)
db = etcdb.New([]string{"http://localhost:4001"})
fmt.Println("Firing up Kenmare in", env, "environment...")
server := web.NewServer(port, []web.Handler{
new(web.SlashHandler),
new(web.CorsHandler),
new(web.GzipHandler),
}, routes)
server.AuthHandler = &web.AuthHandler{Auth: web.DefaultAuthHandler}
server.ListenAndServe()
}