Skip to content

Commit

Permalink
feat: remove warning when the config file is explicitly stdin (#3740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored Mar 29, 2023
1 parent 1e70073 commit ca05239
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pkg/config/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,21 @@ func (r *FileReader) parseConfig() error {
return nil
}

usedConfigFile, err := fsutils.ShortestRelPath(usedConfigFile, "")
if err != nil {
r.log.Warnf("Can't pretty print config file path: %s", err)
if usedConfigFile == os.Stdin.Name() {
usedConfigFile = ""
r.log.Infof("Reading config file stdin")
} else {
var err error
usedConfigFile, err = fsutils.ShortestRelPath(usedConfigFile, "")
if err != nil {
r.log.Warnf("Can't pretty print config file path: %v", err)
}

r.log.Infof("Used config file %s", usedConfigFile)
}
r.log.Infof("Used config file %s", usedConfigFile)
usedConfigDir := filepath.Dir(usedConfigFile)
if usedConfigDir, err = filepath.Abs(usedConfigDir); err != nil {

usedConfigDir, err := filepath.Abs(filepath.Dir(usedConfigFile))
if err != nil {
return errors.New("can't get config directory")
}
r.cfg.cfgDir = usedConfigDir
Expand Down

0 comments on commit ca05239

Please sign in to comment.