1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2025-07-01 04:12:49 +00:00

Don't output message about config file if output format is JSON

This commit is contained in:
Liz Rice 2017-06-23 10:48:49 +01:00
parent 6340ee44c5
commit 07750ea43a
2 changed files with 3 additions and 3 deletions

View File

@ -225,6 +225,8 @@ func colorPrint(state check.State, s string) {
// prettyPrint outputs the results to stdout in human-readable format // prettyPrint outputs the results to stdout in human-readable format
func prettyPrint(warnings []string, r *check.Controls, summary check.Summary) { func prettyPrint(warnings []string, r *check.Controls, summary check.Summary) {
colorPrint(check.INFO, fmt.Sprintf("Using config file: %s\n", viper.ConfigFileUsed()))
for _, w := range warnings { for _, w := range warnings {
colorPrint(check.WARN, w) colorPrint(check.WARN, w)
} }

View File

@ -96,9 +96,7 @@ func initConfig() {
viper.SetDefault("federatedFile", cfgDir+"/federated.yaml") viper.SetDefault("federatedFile", cfgDir+"/federated.yaml")
// If a config file is found, read it in. // If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil { if err := viper.ReadInConfig(); err != nil {
colorPrint(check.INFO, fmt.Sprintf("Using config file: %s\n", viper.ConfigFileUsed()))
} else {
colorPrint(check.FAIL, fmt.Sprintf("Failed to read config file: %v\n", err)) colorPrint(check.FAIL, fmt.Sprintf("Failed to read config file: %v\n", err))
os.Exit(1) os.Exit(1)
} }