From ff1a725a5677721493b2b4dbd6a008ae06991e35 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 5 Jun 2020 10:39:46 +0300 Subject: [PATCH] app/vmauth: print brief usage info for `vmauth -help` --- app/vmauth/main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/vmauth/main.go b/app/vmauth/main.go index 335a527e2..2a5943baf 100644 --- a/app/vmauth/main.go +++ b/app/vmauth/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "net/http" "net/http/httputil" "net/url" @@ -22,6 +23,7 @@ var ( func main() { // Write flags and help message to stdout, since it is easier to grep or pipe. flag.CommandLine.SetOutput(os.Stdout) + flag.Usage = usage envflag.Parse() buildinfo.Init() logger.Init() @@ -80,3 +82,15 @@ var reverseProxy = &httputil.ReverseProxy{ FlushInterval: time.Second, ErrorLog: logger.StdErrorLogger(), } + +func usage() { + const s = ` +vmauth authenticates and authorizes incoming requests and proxies them to VictoriaMetrics. + +See the docs at https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmauth/README.md . +` + + f := flag.CommandLine.Output() + fmt.Fprintf(f, "%s\n", s) + flag.PrintDefaults() +}