From 85ce03af09c6a54a57d7263f77ce8e29a5936d25 Mon Sep 17 00:00:00 2001 From: amone-windows <62925104+amone-bit@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:14:53 +0800 Subject: [PATCH] fix: config file search error --- file.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index a84cdf4..2e2fa8a 100644 --- a/file.go +++ b/file.go @@ -27,8 +27,9 @@ func (v *Viper) findConfigFile() (string, error) { func (v *Viper) searchInPath(in string) (filename string) { v.logger.Debug("searching for config in path", "path", in) if v.configType != "" { - if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b { - return filepath.Join(in, v.configName) + if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+v.configType)); b { + v.logger.Debug("found file", "file", filepath.Join(in, v.configName+"."+v.configType)) + return filepath.Join(in, v.configName+"."+v.configType) } }