Only enable debug logging if debug flag is set
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Elara 2023-06-09 12:33:39 -07:00
parent 0341c7c6b3
commit 12869d1ec0

View File

@ -41,7 +41,6 @@ import (
func init() { func init() {
log.Logger = logger.NewPretty(os.Stderr) log.Logger = logger.NewPretty(os.Stderr)
log.Logger.SetLevel(logger.LogLevelDebug)
} }
func main() { func main() {
@ -51,8 +50,13 @@ func main() {
serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address") serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address")
genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks") genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks")
useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration") useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration")
debug := pflag.BoolP("debug", "d", false, "Enable debug logging")
pflag.Parse() pflag.Parse()
if *debug {
log.Logger.SetLevel(logger.LogLevelDebug)
}
if *genHash { if *genHash {
fmt.Print("Password: ") fmt.Print("Password: ")
pwd, err := term.ReadPassword(int(os.Stdin.Fd())) pwd, err := term.ReadPassword(int(os.Stdin.Fd()))