| skipped 6 lines |
7 | 7 | | "github.com/bearer/bearer/pkg/flag" |
8 | 8 | | "github.com/bearer/bearer/pkg/util/file" |
9 | 9 | | "github.com/bearer/bearer/pkg/util/output" |
10 | | - | "github.com/rs/zerolog/log" |
11 | 10 | | "github.com/spf13/cobra" |
12 | 11 | | "github.com/spf13/viper" |
13 | 12 | | "golang.org/x/xerrors" |
| skipped 44 lines |
58 | 57 | | configPath := viper.GetString(flag.ConfigFileFlag.ConfigName) |
59 | 58 | | defaultConfigPath := file.GetFullFilename(args[0], configPath) |
60 | 59 | | |
61 | | - | loadedFile := false |
| 60 | + | var loadFileMessage string |
62 | 61 | | if err := readConfig(configPath); err != nil { |
63 | 62 | | if err := readConfig(defaultConfigPath); err != nil { |
64 | | - | log.Debug().Msgf("Couldn't find config file %s or %s", configPath, defaultConfigPath) |
| 63 | + | loadFileMessage = fmt.Sprintf("Couldn't find config file %s or %s", configPath, defaultConfigPath) |
65 | 64 | | } else { |
66 | | - | log.Debug().Msgf("Loading default config file %s", defaultConfigPath) |
67 | | - | loadedFile = true |
| 65 | + | loadFileMessage = fmt.Sprintf("Loading default config file %s", defaultConfigPath) |
68 | 66 | | } |
69 | 67 | | } else { |
70 | | - | log.Debug().Msgf("Loading config file %s", configPath) |
71 | | - | loadedFile = true |
| 68 | + | loadFileMessage = fmt.Sprintf("Loading config file %s", configPath) |
72 | 69 | | } |
73 | 70 | | |
74 | 71 | | options, err := ScanFlags.ToOptions(args) |
| skipped 1 lines |
76 | 73 | | return xerrors.Errorf("flag error: %w", err) |
77 | 74 | | } |
78 | 75 | | |
79 | | - | if !options.Quiet && loadedFile { |
80 | | - | output.StdErrLogger().Msgf("Loaded configuration file") |
| 76 | + | if !options.Quiet { |
| 77 | + | output.StdErrLogger().Msgf(loadFileMessage) |
81 | 78 | | } |
82 | 79 | | |
83 | 80 | | output.Setup(cmd, options) |
| skipped 33 lines |