hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 4047ca5c3cf443a3f9b699aa8e2e9389d6eec826
parent dac9c0dae68ec0e918f0e648b11263b6d779dd42
Author: Anthony Fok <foka@debian.org>
Date:   Wed, 19 Aug 2015 00:36:22 -0600

Search current directory for config file by default

As of 2015-08-16, Viper no longer searches the CWD
for config file by default to avoid unintended surprises,
but Hugo relies on the original behaviour.

Fixed by calling

    viper.AddConfigPath(".")

at the appropriate place.

See https://github.com/spf13/viper/issues/73 for more information.

Fixes #1363

Diffstat:
Mcommands/hugo.go | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/commands/hugo.go b/commands/hugo.go
@@ -165,7 +165,12 @@ func LoadDefaultSettings() {
 // InitializeConfig initializes a config file with sensible default configuration flags.
 func InitializeConfig() {
 	viper.SetConfigFile(CfgFile)
-	viper.AddConfigPath(Source)
+	// See https://github.com/spf13/viper/issues/73#issuecomment-126970794
+	if Source == "" {
+		viper.AddConfigPath(".")
+	} else {
+		viper.AddConfigPath(Source)
+	}
 	err := viper.ReadInConfig()
 	if err != nil {
 		jww.ERROR.Println("Unable to locate Config file. Perhaps you need to create a new site. Run `hugo help new` for details")