mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 01:37:52 +02:00
parent
313647b5aa
commit
4897fb399e
@ -8,25 +8,25 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(newGcCmd().cmd)
|
adminCmd.AddCommand(newAdminGcCommand().cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
type gcCmd struct {
|
type adminGcCommand struct {
|
||||||
cmd *cobra.Command
|
cmd *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGcCmd() *gcCmd {
|
func newAdminGcCommand() *adminGcCommand {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "gc <configPath>",
|
Use: "gc <configPath>",
|
||||||
Short: "Garbage collect a zrok instance",
|
Short: "Garbage collect a zrok instance",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
}
|
}
|
||||||
c := &gcCmd{cmd: cmd}
|
c := &adminGcCommand{cmd: cmd}
|
||||||
cmd.Run = c.run
|
cmd.Run = c.run
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gc *gcCmd) run(_ *cobra.Command, args []string) {
|
func (gc *adminGcCommand) run(_ *cobra.Command, args []string) {
|
||||||
cfg, err := controller.LoadConfig(args[0])
|
cfg, err := controller.LoadConfig(args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
@ -16,7 +16,9 @@ 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(adminCmd)
|
||||||
rootCmd.AddCommand(shareCmd)
|
rootCmd.AddCommand(shareCmd)
|
||||||
|
rootCmd.AddCommand(testCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
@ -34,12 +36,22 @@ var apiEndpoint string
|
|||||||
|
|
||||||
var accessCmd = &cobra.Command{
|
var accessCmd = &cobra.Command{
|
||||||
Use: "access",
|
Use: "access",
|
||||||
Short: "Access services",
|
Short: "Create frontend access for services",
|
||||||
|
}
|
||||||
|
|
||||||
|
var adminCmd = &cobra.Command{
|
||||||
|
Use: "admin",
|
||||||
|
Short: "Administration and operations functions",
|
||||||
}
|
}
|
||||||
|
|
||||||
var shareCmd = &cobra.Command{
|
var shareCmd = &cobra.Command{
|
||||||
Use: "share",
|
Use: "share",
|
||||||
Short: "Share resources",
|
Short: "Create backend access for services",
|
||||||
|
}
|
||||||
|
|
||||||
|
var testCmd = &cobra.Command{
|
||||||
|
Use: "test",
|
||||||
|
Short: "Utilities for testing zrok deployments",
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -26,7 +26,7 @@ type reserveCommand struct {
|
|||||||
func newReserveCommand() *reserveCommand {
|
func newReserveCommand() *reserveCommand {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "reserve <public|private> <targetEndpoint>",
|
Use: "reserve <public|private> <targetEndpoint>",
|
||||||
Short: "Reserve a service",
|
Short: "Create a reserved service",
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
}
|
}
|
||||||
command := &reserveCommand{cmd: cmd}
|
command := &reserveCommand{cmd: cmd}
|
||||||
|
@ -14,12 +14,6 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
testCmd.AddCommand(newTestEndpointCommand().cmd)
|
testCmd.AddCommand(newTestEndpointCommand().cmd)
|
||||||
rootCmd.AddCommand(testCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
var testCmd = &cobra.Command{
|
|
||||||
Use: "test",
|
|
||||||
Short: "Utilities used for testing zrok",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type testEndpointCommand struct {
|
type testEndpointCommand struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user