1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-01 15:37:31 +00:00
Files
steve/main.go

43 lines
856 B
Go
Raw Normal View History

2019-08-04 10:41:32 -07:00
package main
import (
"os"
2020-01-30 22:37:59 -07:00
"github.com/rancher/steve/pkg/debug"
stevecli "github.com/rancher/steve/pkg/server/cli"
2019-09-11 14:05:00 -07:00
"github.com/rancher/steve/pkg/version"
"github.com/rancher/wrangler/v2/pkg/signals"
2019-08-04 10:41:32 -07:00
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
2020-01-30 22:37:59 -07:00
config stevecli.Config
debugconfig debug.Config
2019-08-04 10:41:32 -07:00
)
func main() {
app := cli.NewApp()
2019-09-11 14:05:00 -07:00
app.Name = "steve"
2019-08-04 10:41:32 -07:00
app.Version = version.FriendlyVersion()
app.Usage = ""
2020-01-30 22:37:59 -07:00
app.Flags = append(
stevecli.Flags(&config),
debug.Flags(&debugconfig)...)
2019-08-04 10:41:32 -07:00
app.Action = run
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
2020-01-30 22:37:59 -07:00
func run(_ *cli.Context) error {
2022-01-07 14:29:46 -07:00
ctx := signals.SetupSignalContext()
2020-01-30 22:37:59 -07:00
debugconfig.MustSetupDebug()
s, err := config.ToServer(ctx)
if err != nil {
return err
}
2020-01-31 15:10:47 -07:00
return s.ListenAndServe(ctx, config.HTTPSListenPort, config.HTTPListenPort, nil)
2019-08-04 10:41:32 -07:00
}