-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
53 lines (42 loc) · 989 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"context"
"log"
"os"
"path"
"github.com/hatchify/closer"
"github.com/vroomy/vroomy"
_ "go.uber.org/automaxprocs"
_ "github.com/vroomy-ext/digitalocean-s3-plugin"
_ "github.com/vroomy-ext/prometheus-plugin"
_ "github.com/mojura/source-proxy/plugins/apikeys"
_ "github.com/mojura/source-proxy/plugins/health"
_ "github.com/mojura/source-proxy/plugins/proxy"
_ "github.com/mojura/source-proxy/plugins/resources"
)
func main() {
var (
svc *vroomy.Vroomy
err error
)
configPath := os.Getenv("CONFIG_PATH")
if len(configPath) == 0 {
configPath = "./"
}
fullPath := path.Join(configPath, "config.toml")
if svc, err = vroomy.New(fullPath); err != nil {
log.Fatal(err)
}
c := closer.New()
ctx, cancel := context.WithCancel(context.Background())
go func() {
_ = c.Wait()
cancel()
}()
if err = svc.Listen(ctx); err != nil && err != context.Canceled {
log.Fatal(err)
}
if err = svc.Close(); err != nil {
log.Fatal(err)
}
}