forked from rudderlabs/rudder-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (39 loc) · 1.22 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
42
43
44
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."
major, minor, commit, buildDate, builtBy, gitURL, patch, 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,
Major: major,
Minor: minor,
Patch: patch,
Commit: commit,
BuildDate: buildDate,
BuiltBy: builtBy,
GitURL: gitURL,
EnterpriseToken: config.GetString("ENTERPRISE_TOKEN", enterpriseToken),
})
exitCode := r.Run(ctx, os.Args)
cancel()
os.Exit(exitCode)
}