forked from CiscoCloud/marathon-consul
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (28 loc) · 691 Bytes
/
main.go
File metadata and controls
34 lines (28 loc) · 691 Bytes
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
package main
import (
"github.com/CiscoCloud/marathon-consul/config"
"log"
"net/http"
)
const Name = "marathon-consul"
const Version = "0.1.0"
func main() {
config := config.New()
apiConfig, err := config.Registry.Config()
if err != nil {
log.Fatal(err.Error())
}
kv, err := NewKV(apiConfig)
if err != nil {
log.Fatal(err.Error())
}
kv.Prefix = config.Registry.Prefix
// set up routes
http.HandleFunc("/health", HealthHandler)
forwarderHandler := &ForwardHandler{
*kv, config.Verbose, config.Debug,
}
http.HandleFunc("/events", forwarderHandler.Handle)
log.Printf(`listening on "%s"`, config.Web.Listen)
log.Fatal(http.ListenAndServe(config.Web.Listen, nil))
}