1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-27 02:51:10 +00:00
steve/main.go
Darren Shepherd 8b42d0aff8 Refactor
2020-01-30 22:37:59 -07:00

41 lines
817 B
Go

package main
import (
"context"
"os"
"github.com/rancher/steve/pkg/debug"
stevecli "github.com/rancher/steve/pkg/server/cli"
"github.com/rancher/steve/pkg/version"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
config stevecli.Config
debugconfig debug.Config
)
func main() {
app := cli.NewApp()
app.Name = "steve"
app.Version = version.FriendlyVersion()
app.Usage = ""
app.Flags = append(
stevecli.Flags(&config),
debug.Flags(&debugconfig)...)
app.Action = run
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
func run(_ *cli.Context) error {
ctx := signals.SetupSignalHandler(context.Background())
debugconfig.MustSetupDebug()
s := config.MustServerConfig().MustServer()
return s.ListenAndServe(ctx, nil)
}