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

58 lines
1.1 KiB
Go
Raw Normal View History

2019-08-04 17:41:32 +00:00
package main
import (
"context"
"os"
"github.com/rancher/naok/pkg/server"
"github.com/rancher/naok/pkg/version"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
config server.Config
)
func main() {
app := cli.NewApp()
app.Name = "naok"
app.Version = version.FriendlyVersion()
app.Usage = ""
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "kubeconfig",
EnvVar: "KUBECONFIG",
Value: "",
Destination: &config.Kubeconfig,
},
cli.StringFlag{
Name: "namespace",
EnvVar: "NAMESPACE",
Value: "default",
Destination: &config.Namespace,
},
2019-08-08 05:42:15 +00:00
cli.StringFlag{
Name: "listen-address",
EnvVar: "LISTEN_ADDRESS",
Value: ":8080",
Destination: &config.ListenAddress,
},
2019-08-04 17:41:32 +00:00
cli.BoolFlag{Name: "debug"},
}
app.Action = run
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
func run(c *cli.Context) error {
if c.Bool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
ctx := signals.SetupSignalHandler(context.Background())
return server.Run(ctx, config)
}