Add $CERTSPOTTER_CACHE_DIR for specifying cache directory

This commit is contained in:
Andrew Ayer
2025-09-19 22:22:21 -04:00
parent dd76d3f220
commit 820da0e29f
2 changed files with 4 additions and 2 deletions

View File

@@ -78,7 +78,9 @@ func defaultConfigDir() string {
}
}
func defaultCacheDir() string {
if envVar := os.Getenv("CACHE_DIRECTORY"); envVar != "" && startedBySupervisor() {
if envVar := os.Getenv("CERTSPOTTER_CACHE_DIR"); envVar != "" {
return envVar
} else if envVar := os.Getenv("CACHE_DIRECTORY"); envVar != "" && startedBySupervisor() {
return envVar
}
userCacheDir, err := os.UserCacheDir()

View File

@@ -246,7 +246,7 @@ State directory
Cache directory
: Stores cached data. The location is (1) the `CACHE_DIRECTORY` environment, if set and certspotter is running under systemd, or (2) `$XDG_CACHE_HOME/certspotter` (which on Linux is `~/.cache/certspotter` by default). You can delete this directory without impacting functionality, but certspotter may need to perform additional computation or network requests.
: Stores cached data. The location is (1) the `CERTSPOTTER_CACHE_DIR` environment variable if set, (2) the `CACHE_DIRECTORY` environment, if set and certspotter is running under systemd, or (3) `$XDG_CACHE_HOME/certspotter` (which on Linux is `~/.cache/certspotter` by default). You can delete this directory without impacting functionality, but certspotter may need to perform additional computation or network requests.
# SEE ALSO