8000 fix: Accept CODER_CACHE_DIRECTORY with CACHE_DIRECTORY fallback by mafredri · Pull Request #2236 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix: Accept CODER_CACHE_DIRECTORY with CACHE_DIRECTORY fallback #2236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2022
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
chore: Move defaultCacheDir closer to use
  • Loading branch information
mafredri committed Jun 10, 2022
commit 7602173bdc8e5a9b8370f8eb402c5b75e5c9a3d3
11 changes: 5 additions & 6 deletions cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ 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 Down Expand Up @@ -479,6 +473,11 @@ func server() *cobra.Command {
cliflag.StringVarP(root.Flags(), &promAddress, "prometheus-address", "", "CODER_PROMETHEUS_ADDRESS", "127.0.0.1:2112", "The address to serve prometheus metrics.")
cliflag.BoolVarP(root.Flags(), &pprofEnabled, "pprof-enable", "", "CODER_PPROF_ENABLE", false, "Enable serving pprof metrics on the address defined by --pprof-address.")
cliflag.StringVarP(root.Flags(), &pprofAddress, "pprof-address", "", "CODER_PPROF_ADDRESS", "127.0.0.1:6060", "The address to serve pprof.")
defaultCacheDir := filepath.Join(os.TempDir(), "coder-cache")
if dir := os.Getenv("CACHE_DIRECTORY"); dir != "" {
// For compatibility with systemd.
defaultCacheDir = dir
}
cliflag.StringVarP(root.Flags(), &cacheDir, "cache-dir", "", "CODER_CACHE_DIRECTORY", defaultCacheDir, "Specifies a directory to cache binaries for provision operations. If unspecified and $CACHE_DIRECTORY is set, it will be used for compatibility with systemd.")
cliflag.BoolVarP(root.Flags(), &dev, "dev", "", "CODER_DEV_MODE", false, "Serve Coder in dev mode for tinkering")
cliflag.StringVarP(root.Flags(), &devUserEmail, "dev-admin-email", "", "CODER_DEV_ADMIN_EMAIL", "admin@coder.com", "Specifies the admin email to be used in dev mode (--dev)")
Expand Down
0