hugo/config
Bjørn Erik Pedersen b3f10556f0
Use os.UserCacheDir as first fallback if cacheDir is not set
We will now try

1. cacheDir (or, commonly set in environment as `HUGO_CACHEDIR`)
2. if on Netlify we use `/opt/build/cache/hugo_cache/`
3. os.UserCacheDir
4. A temp dir

Storing the cache, especially the module cache, in a temporary idea has had lots of hard to debug issues, especially on MacOS,
which this commit tries to fix.

This should also make it easier to locate the Hugo cache:

>UserCacheDir returns the default root directory to use for user-specific cached data. Users should create their own
application-specific subdirectory within this one and use that.
>
>On Unix systems, it returns $XDG_CACHE_HOME as specified by
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.cache. On Darwin, it
returns $HOME/Library/Caches. On Windows, it returns %LocalAppData%. On Plan 9, it returns $home/lib/cache.
>
>If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

Fixes #11286
Fixes #11291
2023-07-27 20:59:47 +02:00
..
allconfig Use os.UserCacheDir as first fallback if cacheDir is not set 2023-07-27 20:59:47 +02:00
privacy Misc config loading fixes 2021-06-14 17:00:32 +02:00
security config: Expand default security.exec.osEnv policy 2023-07-07 13:54:06 +02:00
services Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
testconfig Add empty Environ when loading test config 2023-06-19 17:49:45 +02:00
commonConfig.go Fix cache busting setup 2023-07-19 19:50:37 +02:00
commonConfig_test.go Fix cache busting setup 2023-07-19 19:50:37 +02:00
configLoader.go commands,config: Fix typo in log and error messages 2023-06-12 16:45:20 +02:00
configLoader_test.go tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
configProvider.go Fix defaultContentLanguageInSubdir with only 1 language 2023-07-08 16:08:46 +02:00
configProvider_test.go Misc config loading fixes 2021-06-14 17:00:32 +02:00
defaultConfigProvider.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
defaultConfigProvider_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
docshelper.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
env.go all: Use strings.Cut 2022-03-21 09:32:35 +01:00
env_test.go tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
namespace.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
namespace_test.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00