http frontend -> access public (#121)

This commit is contained in:
Michael Quigley 2022-12-01 13:11:38 -05:00
parent 44f4e37e83
commit 313647b5aa
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 7 additions and 13 deletions

View File

@ -9,26 +9,26 @@ import (
) )
func init() { func init() {
httpCmd.AddCommand(newHttpFrontendCommand().cmd) accessCmd.AddCommand(newAccessPublicCommand().cmd)
} }
type httpFrontendCommand struct { type accessPublicCommand struct {
cmd *cobra.Command cmd *cobra.Command
} }
func newHttpFrontendCommand() *httpFrontendCommand { func newAccessPublicCommand() *accessPublicCommand {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "frontend [<configPath>]", Use: "public [<configPath>]",
Aliases: []string{"fe"}, Aliases: []string{"fe"},
Short: "Create an HTTP frontend", Short: "Create a public access HTTP frontend",
Args: cobra.RangeArgs(0, 1), Args: cobra.RangeArgs(0, 1),
} }
command := &httpFrontendCommand{cmd: cmd} command := &accessPublicCommand{cmd: cmd}
cmd.Run = command.run cmd.Run = command.run
return command return command
} }
func (self *httpFrontendCommand) run(_ *cobra.Command, args []string) { func (self *accessPublicCommand) run(_ *cobra.Command, args []string) {
cfg := public_frontend.DefaultConfig() cfg := public_frontend.DefaultConfig()
if len(args) == 1 { if len(args) == 1 {
if err := cfg.Load(args[0]); err != nil { if err := cfg.Load(args[0]); err != nil {

View File

@ -16,7 +16,6 @@ func init() {
rootCmd.PersistentFlags().BoolVarP(&panicInstead, "panic", "p", false, "Panic instead of showing pretty errors") rootCmd.PersistentFlags().BoolVarP(&panicInstead, "panic", "p", false, "Panic instead of showing pretty errors")
zrokdir.AddZrokApiEndpointFlag(&apiEndpoint, rootCmd.PersistentFlags()) zrokdir.AddZrokApiEndpointFlag(&apiEndpoint, rootCmd.PersistentFlags())
rootCmd.AddCommand(accessCmd) rootCmd.AddCommand(accessCmd)
rootCmd.AddCommand(httpCmd)
rootCmd.AddCommand(shareCmd) rootCmd.AddCommand(shareCmd)
} }
@ -38,11 +37,6 @@ var accessCmd = &cobra.Command{
Short: "Access services", Short: "Access services",
} }
var httpCmd = &cobra.Command{
Use: "http",
Short: "HTTP endpoint operations",
}
var shareCmd = &cobra.Command{ var shareCmd = &cobra.Command{
Use: "share", Use: "share",
Short: "Share resources", Short: "Share resources",