http command scaffolding

This commit is contained in:
Michael Quigley 2022-07-20 13:18:40 -04:00
parent 50d37132a1
commit 084cdf96df
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti-test-kitchen/zrok/http"
"github.com/openziti-test-kitchen/zrok/proxy"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -13,6 +14,7 @@ import (
func init() {
pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/"))
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "enable verbose logging")
rootCmd.AddCommand(httpCmd)
rootCmd.AddCommand(proxyCmd)
}
@ -37,6 +39,16 @@ var proxyCmd = &cobra.Command{
},
}
var httpCmd = &cobra.Command{
Use: "http <endpointAddress>",
Short: "Start an http endpoint",
Run: func(_ *cobra.Command, args []string) {
if err := http.Run(&http.Config{EndpointAddress: args[0]}); err != nil {
panic(err)
}
},
}
func main() {
if err := rootCmd.Execute(); err != nil {
panic(err)

5
http/config.go Normal file
View File

@ -0,0 +1,5 @@
package http
type Config struct {
EndpointAddress string
}

5
http/http.go Normal file
View File

@ -0,0 +1,5 @@
package http
func Run(cfg *Config) error {
return nil
}