aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/commandfuncs.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-12-31 16:47:35 -0700
committerMatthew Holt <[email protected]>2019-12-31 16:47:35 -0700
commit984d384d148090cdb0f6aa2f234a8b946c3b9ee3 (patch)
tree97ddb9038a34d499b51b84f02459a97d476abb2b /cmd/commandfuncs.go
parentfdabac51a8c8801840679a24e371f23013b021bb (diff)
downloadcaddy-984d384d148090cdb0f6aa2f234a8b946c3b9ee3.tar.gz
caddy-984d384d148090cdb0f6aa2f234a8b946c3b9ee3.zip
Change storage paths to follow OS conventions; migrate folder (#2955)
Diffstat (limited to 'cmd/commandfuncs.go')
-rw-r--r--cmd/commandfuncs.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index 6dc7c5229..cc55df2f0 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -154,6 +154,8 @@ func cmdRun(fl Flags) (int, error) {
if err != nil {
return caddy.ExitCodeFailedStartup, err
}
+ // TODO: This is TEMPORARY, until the RCs
+ moveStorage()
// set a fitting User-Agent for ACME requests
goModule := caddy.GoModule()
@@ -190,6 +192,25 @@ func cmdRun(fl Flags) (int, error) {
}
}
+ // warn if the environment does not provide enough information about the disk
+ hasXDG := os.Getenv("XDG_DATA_HOME") != "" &&
+ os.Getenv("XDG_CONFIG_HOME") != "" &&
+ os.Getenv("XDG_CACHE_HOME") != ""
+ switch runtime.GOOS {
+ case "windows":
+ if os.Getenv("HOME") == "" && os.Getenv("USERPROFILE") == "" && !hasXDG {
+ caddy.Log().Warn("neither HOME nor USERPROFILE environment variables are set - please fix; some assets might be stored in ./caddy")
+ }
+ case "plan9":
+ if os.Getenv("home") == "" && !hasXDG {
+ caddy.Log().Warn("$home environment variable is empty - please fix; some assets might be stored in ./caddy")
+ }
+ default:
+ if os.Getenv("HOME") == "" && !hasXDG {
+ caddy.Log().Warn("$HOME environment variable is empty - please fix; some assets might be stored in ./caddy")
+ }
+ }
+
select {}
}