Allow to set cache dir in config file
authorDimitri Merejkowsky <dmerejkowsky@users.noreply.github.com>
Sun, 9 Oct 2016 09:00:36 +0000 (11:00 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 9 Oct 2016 09:00:36 +0000 (11:00 +0200)
commands/hugo.go
docs/content/extras/datadrivencontent.md

index 4c6a0597c0a1c835585414ec2b1a1f47a9be59b6..4c284737d409910a10cc7db228490a905652ade0 100644 (file)
@@ -372,6 +372,11 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
                viper.Set("LayoutDir", layoutDir)
        }
 
+       if cacheDir != "" {
+               viper.Set("CacheDir", cacheDir)
+       }
+
+       cacheDir = viper.GetString("cacheDir")
        if cacheDir != "" {
                if helpers.FilePathSeparator != cacheDir[len(cacheDir)-1:] {
                        cacheDir = cacheDir + helpers.FilePathSeparator
index a1cef524c755f890cab1232838c405594fc51c15..fc7e18cf84591e7a5bab3c37b5fa853aad2db446 100644 (file)
@@ -103,6 +103,8 @@ temporary directory.
 With the command-line flag `--cacheDir`, you can specify any folder on
 your system as a caching directory.
 
+You can also set `cacheDir` in the main configuration file.
+
 If you don't like caching at all, you can fully disable caching with the
 command line flag `--ignoreCache`.