@@ -785,11 +785,16 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, error))
785
785
"Serve pprof metrics on the address defined by `pprof-address`." )
786
786
cliflag .StringVarP (root .Flags (),& pprofAddress ,"pprof-address" ,"" ,"CODER_PPROF_ADDRESS" ,"127.0.0.1:6060" ,
787
787
"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
+ }
789
793
if dir := os .Getenv ("CACHE_DIRECTORY" );dir != "" {
790
794
// For compatibility with systemd.
791
795
defaultCacheDir = dir
792
796
}
797
+ defaultCacheDir = filepath .Join (defaultCacheDir ,"coder" )
793
798
cliflag .StringVarP (root .Flags (),& cacheDir ,"cache-dir" ,"" ,"CODER_CACHE_DIRECTORY" ,defaultCacheDir ,
794
799
"The directory to cache temporary files. If unspecified and $CACHE_DIRECTORY is set, it will be used for compatibility with systemd." )
795
800
cliflag .BoolVarP (root .Flags (),& inMemoryDatabase ,"in-memory" ,"" ,"CODER_INMEMORY" ,false ,