diff --git a/viper.go b/viper.go index ad8a037..89e3326 100644 --- a/viper.go +++ b/viper.go @@ -1734,6 +1734,15 @@ func (v *Viper) getConfigFile() (string, error) { return v.getConfigFile() } +func GetConfigFilePath() (string, error) { + // Returns the path where Viper actually found the logfile it uses. + // + // Useful when you want to write the configPath to logfiles, stdout, etc. + // Comes in handy during debugging or when running in production environments. + cf, err := v.getConfigFile() + return cf, err +} + func (v *Viper) searchInPath(in string) (filename string) { jww.DEBUG.Println("Searching for config in ", in) for _, ext := range SupportedExts {