1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-27 11:00:48 +00:00
steve/main.go

41 lines
817 B
Go
Raw Normal View History

2019-08-04 17:41:32 +00:00
package main
import (
"context"
"os"
2020-01-31 05:37:59 +00:00
"github.com/rancher/steve/pkg/debug"
stevecli "github.com/rancher/steve/pkg/server/cli"
2019-09-11 21:05:00 +00:00
"github.com/rancher/steve/pkg/version"
2019-08-04 17:41:32 +00:00
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
2020-01-31 05:37:59 +00:00
config stevecli.Config
debugconfig debug.Config
2019-08-04 17:41:32 +00:00
)
func main() {
app := cli.NewApp()
2019-09-11 21:05:00 +00:00
app.Name = "steve"
2019-08-04 17:41:32 +00:00
app.Version = version.FriendlyVersion()
app.Usage = ""
2020-01-31 05:37:59 +00:00
app.Flags = append(
stevecli.Flags(&config),
debug.Flags(&debugconfig)...)
2019-08-04 17:41:32 +00:00
app.Action = run
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
2020-01-31 05:37:59 +00:00
func run(_ *cli.Context) error {
2019-08-04 17:41:32 +00:00
ctx := signals.SetupSignalHandler(context.Background())
2020-01-31 05:37:59 +00:00
debugconfig.MustSetupDebug()
s := config.MustServerConfig().MustServer()
return s.ListenAndServe(ctx, nil)
2019-08-04 17:41:32 +00:00
}