From 02dcd4dc75d7f83cc88b451fed137bbc87ff7410 Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Wed, 30 Oct 2024 04:52:49 +0100 Subject: [PATCH] Add command usage example --- README.md | 7 ++++--- cmd/config/config.go | 2 +- cmd/root.go | 2 +- util/constants.go | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fc5b267..cb9ee4b 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ gateway: readTimeout: 15 # Proxy idle timeout idleTimeout: 60 - # Proxy rate limit, it's In-Memory Token Bucket + # Proxy rate limit, it's In-Memory IP based # Distributed Rate Limiting for Token based across multiple instances is not yet integrated rateLimiter: 0 accessLog: "/dev/Stdout" @@ -128,6 +128,7 @@ gateway: disableRouteHealthCheckError: false # Disable display routes on start disableDisplayRouteOnStart: false + disableKeepAlive: false # interceptErrors intercepts backend errors based on defined the status codes interceptErrors: - 405 @@ -237,14 +238,14 @@ gateway: middlewares: # Enable Basic auth authorization based - name: local-auth-basic - # Authentication types | jwtAuth, basicAuth, auth0 + # Authentication types | jwt, basic, OAuth type: basic rule: username: admin password: admin #Enables JWT authorization based on the result of a request and continues the request. - name: google-auth - # Authentication types | jwtAuth, basicAuth, OAuth + # Authentication types | jwt, basic, OAuth # jwt authorization based on the result of backend's response and continue the request when the client is authorized type: jwt rule: diff --git a/cmd/config/config.go b/cmd/config/config.go index ce6112b..7bca009 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -23,7 +23,7 @@ import ( var Cmd = &cobra.Command{ Use: "config", - Short: "Goma configuration", + Short: "Goma Gateway configuration management", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { return diff --git a/cmd/root.go b/cmd/root.go index 814ff8b..ebd621b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -28,7 +28,7 @@ var rootCmd = &cobra.Command{ Use: "goma", Short: "Goma Gateway is a lightweight API Gateway, Reverse Proxy", Long: `.`, - Example: "", + Example: util.MainExample, Version: util.FullVersion(), } diff --git a/util/constants.go b/util/constants.go index 2bcc2a9..e003539 100644 --- a/util/constants.go +++ b/util/constants.go @@ -29,3 +29,7 @@ func FullVersion() string { } return ver } + +const MainExample = "Initialize config: init config --output config.yml\n" + + "Start server: server \n" + + "Start server with custom config file: server --config config.yml"