-
Notifications
You must be signed in to change notification settings - Fork 10
/
parkeeper.go
51 lines (43 loc) · 1.07 KB
/
parkeeper.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
48
49
50
51
package main
import (
"os"
kv "github.com/glerchundi/kvstores"
"github.com/glerchundi/parkeeper/keeper"
"github.com/glerchundi/parkeeper/log"
"github.com/codegangsta/cli"
)
func appMain(c *cli.Context) {
// flags
bindAddr := c.String("bind-addr")
backendUrl := c.String("backend-url")
// configure main logger
log.SetLogger(log.NewLogger(false, true, true))
// backend client
storeClient, err := kv.NewClient(backendUrl)
if err != nil {
panic(err)
}
// start listening
server := keeper.NewServer(bindAddr, storeClient)
server.Start()
}
func main() {
app := cli.NewApp()
app.Name = "parkeeper"
app.Version = releaseVersion
app.Usage = "acts as a zookeeper service bridging all requests to etcd/consul"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "bind-addr",
Value: "0.0.0.0:2181",
Usage: "bind this server to a custom internal address",
},
cli.StringFlag{
Name: "backend-url",
Value: "etcd://127.0.0.1:4001",
Usage: "backend to use (etcd://127.0.0.1:4001, consul://127.0.0.1:8500)",
},
}
app.Action = appMain
app.Run(os.Args)
}