mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 01:37:52 +02:00
http command scaffolding
This commit is contained in:
parent
50d37132a1
commit
084cdf96df
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/michaelquigley/pfxlog"
|
"github.com/michaelquigley/pfxlog"
|
||||||
|
"github.com/openziti-test-kitchen/zrok/http"
|
||||||
"github.com/openziti-test-kitchen/zrok/proxy"
|
"github.com/openziti-test-kitchen/zrok/proxy"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -13,6 +14,7 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/"))
|
pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/"))
|
||||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "enable verbose logging")
|
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "enable verbose logging")
|
||||||
|
rootCmd.AddCommand(httpCmd)
|
||||||
rootCmd.AddCommand(proxyCmd)
|
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() {
|
func main() {
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
5
http/config.go
Normal file
5
http/config.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
EndpointAddress string
|
||||||
|
}
|
5
http/http.go
Normal file
5
http/http.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
func Run(cfg *Config) error {
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user