mirror of
https://github.com/openziti/zrok.git
synced 2024-11-26 10:04:16 +01:00
36 lines
878 B
Go
36 lines
878 B
Go
package main
|
|
|
|
import (
|
|
"github.com/michaelquigley/pfxlog"
|
|
"github.com/openziti-test-kitchen/zrok/zrokdir"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
func init() {
|
|
pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/"))
|
|
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
|
|
zrokdir.AddZrokApiEndpointFlag(&apiEndpoint, rootCmd.PersistentFlags())
|
|
}
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: strings.TrimSuffix(filepath.Base(os.Args[0]), filepath.Ext(os.Args[0])),
|
|
Short: "zrok loopback harness",
|
|
PersistentPreRun: func(_ *cobra.Command, _ []string) {
|
|
if verbose {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
}
|
|
},
|
|
}
|
|
var verbose bool
|
|
var apiEndpoint string
|
|
|
|
func main() {
|
|
if err := rootCmd.Execute(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|