Skip to content

Commit f160830

Browse files
authored
fix: Update default cache directory (#4175)
Fixes #2534.
1 parent 38e2a28 commit f160830

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cli/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,16 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, error))
785785
"Serve pprof metrics on the address defined by `pprof-address`.")
786786
cliflag.StringVarP(root.Flags(), &pprofAddress, "pprof-address", "", "CODER_PPROF_ADDRESS", "127.0.0.1:6060",
787787
"The bind address to serve pprof.")
788-
defaultCacheDir := filepath.Join(os.TempDir(), "coder-cache")
788+
789+
defaultCacheDir, err := os.UserCacheDir()
790+
if err != nil {
791+
defaultCacheDir = os.TempDir()
792+
}
789793
if dir := os.Getenv("CACHE_DIRECTORY"); dir != "" {
790794
// For compatibility with systemd.
791795
defaultCacheDir = dir
792796
}
797+
defaultCacheDir = filepath.Join(defaultCacheDir, "coder")
793798
cliflag.StringVarP(root.Flags(), &cacheDir, "cache-dir", "", "CODER_CACHE_DIRECTORY", defaultCacheDir,
794799
"The directory to cache temporary files. If unspecified and $CACHE_DIRECTORY is set, it will be used for compatibility with systemd.")
795800
cliflag.BoolVarP(root.Flags(), &inMemoryDatabase, "in-memory", "", "CODER_INMEMORY", false,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy