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"
|
2024-06-05 00:22:48 +05:30
|
|
|
"github.com/rancher/wrangler/v3/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()
|
2024-10-31 10:48:05 -07:00
|
|
|
s, err := config.ToServer(ctx, debugconfig.SQLCache)
|
2020-06-11 21:50:59 -07:00
|
|
|
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
|
|
|
}
|