-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfigure.go
More file actions
40 lines (34 loc) · 808 Bytes
/
configure.go
File metadata and controls
40 lines (34 loc) · 808 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
35
36
37
38
39
40
package main
import (
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
cs "github.com/webtor-io/common-services"
s "github.com/webtor-io/external-proxy/services"
)
func configure(app *cli.App) {
app.Flags = []cli.Flag{}
app.Flags = cs.RegisterProbeFlags(app.Flags)
app.Flags = s.RegisterWebFlags(app.Flags)
app.Action = run
}
func run(c *cli.Context) error {
var servers []cs.Servable
// Setting ProbeService
probe := cs.NewProbe(c)
if probe != nil {
servers = append(servers, probe)
defer probe.Close()
}
// Setting WebService
web := s.NewWeb(c)
defer web.Close()
servers = append(servers, web)
// Setting ServeService
serve := cs.NewServe(servers...)
// And SERVE!
err := serve.Serve()
if err != nil {
log.WithError(err).Error("got server error")
}
return err
}