From 56512e816fc88f90a7643526d93358fa4761200d Mon Sep 17 00:00:00 2001 From: Dimitri Merejkowsky Date: Sun, 9 Oct 2016 11:00:36 +0200 Subject: [PATCH] Allow to set cache dir in config file --- commands/hugo.go | 5 +++++ docs/content/extras/datadrivencontent.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/commands/hugo.go b/commands/hugo.go index 4c6a0597c..4c284737d 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -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 diff --git a/docs/content/extras/datadrivencontent.md b/docs/content/extras/datadrivencontent.md index a1cef524c..fc7e18cf8 100644 --- a/docs/content/extras/datadrivencontent.md +++ b/docs/content/extras/datadrivencontent.md @@ -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`.