mirror of
https://github.com/rancher/steve.git
synced 2025-08-10 18:51:36 +00:00
52 lines
975 B
Go
52 lines
975 B
Go
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,
|
|
},
|
|
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)
|
|
}
|