-
Notifications
You must be signed in to change notification settings - Fork 320
/
main.go
41 lines (35 loc) · 1.06 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
package main
import (
"context"
"os"
"os/signal"
"runtime/debug"
"syscall"
_ "go.uber.org/automaxprocs"
"github.com/rudderlabs/rudder-go-kit/config"
"github.com/rudderlabs/rudder-go-kit/logger"
"github.com/rudderlabs/rudder-go-kit/mem"
"github.com/rudderlabs/rudder-server/runner"
)
var (
version = "Not an official release. Get the latest release from the github repo."
commit, buildDate, builtBy, enterpriseToken string
)
func main() {
if memStat, err := mem.Get(); err == nil {
memoryLimit := int64(80 * memStat.Total / 100)
logger.NewLogger().Infow("Setting memory limit to", "limit", memoryLimit)
debug.SetMemoryLimit(memoryLimit)
}
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
r := runner.New(runner.ReleaseInfo{
Version: version,
Commit: commit,
BuildDate: buildDate,
BuiltBy: builtBy,
EnterpriseToken: config.GetString("ENTERPRISE_TOKEN", enterpriseToken),
})
exitCode := r.Run(ctx, os.Args)
cancel()
os.Exit(exitCode)
}