mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-20 12:03:57 +00:00
feat(cli): improve parameters desc
This commit is contained in:
parent
73102b6fc2
commit
d8d440a6b1
|
@ -19,20 +19,25 @@ type Config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = &Config{
|
var config = &Config{
|
||||||
ListenAddr: flag.String("listen", getEnv("LISTEN_ADDR", ":8080"), "HTTP service address (e.g.address, ':8080')"),
|
ListenAddr: flag.String("listen", getEnv("LISTEN_ADDR", ":8080"), "HTTP service address"),
|
||||||
NbWorkers: flag.Int("nb-workers", getIntEnv("NB_WORKERS", 2), "The number of workers to start"),
|
NbWorkers: flag.Int("nb-workers", getIntEnv("NB_WORKERS", 2), "The number of workers to start"),
|
||||||
Debug: flag.Bool("debug", getBoolEnv("DEBUG", false), "Output debug logs"),
|
Debug: flag.Bool("debug", getBoolEnv("DEBUG", false), "Output debug logs"),
|
||||||
Timeout: flag.Int("timeout", getIntEnv("HOOK_TIMEOUT", 10), "Hook maximum delay before timeout (in second)"),
|
Timeout: flag.Int("timeout", getIntEnv("HOOK_TIMEOUT", 10), "Hook maximum delay (in second) before timeout"),
|
||||||
ScriptDir: flag.String("scripts", getEnv("SCRIPTS_DIR", "scripts"), "Scripts directory"),
|
ScriptDir: flag.String("scripts", getEnv("SCRIPTS_DIR", "scripts"), "Scripts directory"),
|
||||||
PasswdFile: flag.String("passwd", getEnv("PASSWD_FILE", ".htpasswd"), "Password file (encoded with htpasswd)"),
|
PasswdFile: flag.String("passwd", getEnv("PASSWD_FILE", ".htpasswd"), "Password file encoded with htpasswd"),
|
||||||
LogDir: flag.String("log-dir", getEnv("LOG_DIR", os.TempDir()), "Webhooks execution log directory"),
|
LogDir: flag.String("log-dir", getEnv("LOG_DIR", os.TempDir()), "Webhooks execution log directory"),
|
||||||
NotificationURI: flag.String("notification-uri", getEnv("NOTIFICATION_URI", ""), "Notification URI"),
|
NotificationURI: flag.String("notification-uri", getEnv("NOTIFICATION_URI", ""), "Notification URI"),
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.StringVar(config.ListenAddr, "l", *config.ListenAddr, "HTTP service (e.g address: ':8080')")
|
// set shorthand parameters
|
||||||
flag.BoolVar(config.Debug, "d", *config.Debug, "Output debug logs")
|
const shorthand = " (shorthand)"
|
||||||
flag.StringVar(config.PasswdFile, "p", *config.PasswdFile, "Password file (encoded with htpasswd)")
|
usage := flag.Lookup("listen").Usage + shorthand
|
||||||
|
flag.StringVar(config.ListenAddr, "l", *config.ListenAddr, usage)
|
||||||
|
usage = flag.Lookup("debug").Usage + shorthand
|
||||||
|
flag.BoolVar(config.Debug, "d", *config.Debug, usage)
|
||||||
|
usage = flag.Lookup("passwd").Usage + shorthand
|
||||||
|
flag.StringVar(config.PasswdFile, "p", *config.PasswdFile, usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get global configuration
|
// Get global configuration
|
||||||
|
|
Loading…
Reference in New Issue
Block a user