fix: honor global flag --debug
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
+2
-20
@@ -25,7 +25,6 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/BBVA/kapow/internal/logger"
|
||||
"github.com/BBVA/kapow/internal/server"
|
||||
)
|
||||
|
||||
@@ -47,7 +46,7 @@ var ServerCmd = &cobra.Command{
|
||||
|
||||
sConf.ClientAuth, _ = cmd.Flags().GetBool("clientauth")
|
||||
sConf.ClientCaFile, _ = cmd.Flags().GetString("clientcafile")
|
||||
debug, _ := cmd.Flags().GetBool("debug")
|
||||
sConf.Debug, _ = cmd.Flags().GetBool("debug")
|
||||
|
||||
// Set environment variables KAPOW_DATA_URL and KAPOW_CONTROL_URL only if they aren't set so we don't overwrite user's preferences
|
||||
if _, exist := os.LookupEnv("KAPOW_DATA_URL"); !exist {
|
||||
@@ -57,10 +56,6 @@ var ServerCmd = &cobra.Command{
|
||||
os.Setenv("KAPOW_CONTROL_URL", "http://"+sConf.ControlBindAddr)
|
||||
}
|
||||
|
||||
if debug {
|
||||
logger.RegisterLogger(logger.SCRIPTS, nil)
|
||||
}
|
||||
|
||||
server.StartServer(sConf)
|
||||
|
||||
if len(args) > 0 {
|
||||
@@ -83,11 +78,7 @@ var ServerCmd = &cobra.Command{
|
||||
log.Printf("Done running powfile: %q\n", powfile)
|
||||
}
|
||||
|
||||
if debug {
|
||||
processLogs()
|
||||
} else {
|
||||
select {}
|
||||
}
|
||||
select {}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -123,12 +114,3 @@ func validateServerCommandArguments(cmd *cobra.Command, args []string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func processLogs() {
|
||||
|
||||
for {
|
||||
if !logger.ProcessMsg(logger.SCRIPTS) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user