-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
38 lines (31 loc) · 1.01 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
package main
import (
"fmt"
"github.com/simplecontainer/smr/pkg/api"
"github.com/simplecontainer/smr/pkg/commands"
_ "github.com/simplecontainer/smr/pkg/commands"
"github.com/simplecontainer/smr/pkg/configuration"
"github.com/simplecontainer/smr/pkg/helpers"
"github.com/simplecontainer/smr/pkg/logger"
"github.com/simplecontainer/smr/pkg/startup"
"github.com/simplecontainer/smr/pkg/static"
_ "net/http/pprof"
"os"
)
func main() {
startup.SetFlags()
logLevel := os.Getenv("LOG_LEVEL")
if logLevel == "" {
logLevel = static.DEFAULT_LOG_LEVEL
}
logger.Log = logger.NewLogger(logLevel, []string{"stdout"}, []string{"stderr"})
fmt.Println(fmt.Sprintf("logging level set to %s (override with LOG_LEVEL env variable)", logLevel))
// Prepare configuration for the commands
conf := configuration.NewConfig()
api := api.NewApi(conf)
api.VersionServer = SMR_VERSION
api.Manager.LogLevel = helpers.GetLogLevel(logLevel)
// Run any commands before starting daemon
commands.PreloadCommands()
commands.Run(api)
}