Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Reveal CACHE_DIRECTORY value by updating default
  • Loading branch information
mafredri committed Jun 10, 2022
commit 9e458d0cabe51622c1b1c87f96e75f33eb2c1638
12 changes: 6 additions & 6 deletions cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ import (

// nolint:gocyclo
func server() *cobra.Command {
defaultCacheDir := filepath.Join(os.TempDir(), "coder-cache")
if dir := os.Getenv("CACHE_DIRECTORY"); dir != "" {
// For compatibility with systemd.
defaultCacheDir = dir
}

var (
accessURL string
address string
Expand All @@ -68,7 +74,6 @@ func server() *cobra.Command {
promAddress string
pprofEnabled bool
pprofAddress string
defaultCacheDir = filepath.Join(os.TempDir(), "coder-cache")
cacheDir string
dev bool
devUserEmail string
Expand Down Expand Up @@ -100,11 +105,6 @@ func server() *cobra.Command {
Use: "server",
Short: "Start a Coder server",
RunE: func(cmd *cobra.Command, args []string) error {
if cacheDir == defaultCacheDir && os.Getenv("CACHE_DIRECTORY") != "" {
// For compatibility with systemd.
cacheDir = os.Getenv("CACHE_DIRECTORY")
}

logger := slog.Make(sloghuman.Sink(os.Stderr))
buildModeDev := semver.Prerelease(buildinfo.Version()) == "-devel"
if verbose || buildModeDev {
Expand Down