diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2021-02-22 15:19:09 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2021-02-22 15:19:35 -0700 |
commit | f6bb02b303d4a24c6932fd832f7aa9de224b6833 (patch) | |
tree | 3517a94d4683f057d079aa79f5a8fb5fce8aafcc /cmd | |
parent | 6722ae3a835702073682e020d8736140fc04538e (diff) |
caddytls: Remove old asset migration code (close #3894)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/commandfuncs.go | 3 | ||||
-rw-r--r-- | cmd/main.go | 68 |
2 files changed, 0 insertions, 71 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index 2b437c3..77d95b9 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -174,9 +174,6 @@ func cmdRun(fl Flags) (int, error) { printEnvironment() } - // TODO: This is TEMPORARY, until the RCs - moveStorage() - // load the config, depending on flags var config []byte var err error diff --git a/cmd/main.go b/cmd/main.go index 5643431..c4d262a 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -450,71 +450,3 @@ func caddyVersion() string { } return ver } - -// moveStorage moves the old default dataDir to the new default dataDir. -// TODO: This is TEMPORARY until the release candidates. -func moveStorage() { - // get the home directory (the old way) - oldHome := os.Getenv("HOME") - if oldHome == "" && runtime.GOOS == "windows" { - drive := os.Getenv("HOMEDRIVE") - path := os.Getenv("HOMEPATH") - oldHome = drive + path - if drive == "" || path == "" { - oldHome = os.Getenv("USERPROFILE") - } - } - if oldHome == "" { - oldHome = "." - } - oldDataDir := filepath.Join(oldHome, ".local", "share", "caddy") - - // nothing to do if old data dir doesn't exist - _, err := os.Stat(oldDataDir) - if os.IsNotExist(err) { - return - } - - // nothing to do if the new data dir is the same as the old one - newDataDir := caddy.AppDataDir() - if oldDataDir == newDataDir { - return - } - - logger := caddy.Log().Named("automigrate").With( - zap.String("old_dir", oldDataDir), - zap.String("new_dir", newDataDir)) - - logger.Info("beginning one-time data directory migration", - zap.String("details", "https://github.com/caddyserver/caddy/issues/2955")) - - // if new data directory exists, avoid auto-migration as a conservative safety measure - _, err = os.Stat(newDataDir) - if !os.IsNotExist(err) { - logger.Error("new data directory already exists; skipping auto-migration as conservative safety measure", - zap.Error(err), - zap.String("instructions", "https://github.com/caddyserver/caddy/issues/2955#issuecomment-570000333")) - return - } - - // construct the new data directory's parent folder - err = os.MkdirAll(filepath.Dir(newDataDir), 0700) - if err != nil { - logger.Error("unable to make new datadirectory - follow link for instructions", - zap.String("instructions", "https://github.com/caddyserver/caddy/issues/2955#issuecomment-570000333"), - zap.Error(err)) - return - } - - // folder structure is same, so just try to rename (move) it; - // this fails if the new path is on a separate device - err = os.Rename(oldDataDir, newDataDir) - if err != nil { - logger.Error("new data directory already exists; skipping auto-migration as conservative safety measure - follow link for instructions", - zap.String("instructions", "https://github.com/caddyserver/caddy/issues/2955#issuecomment-570000333"), - zap.Error(err)) - } - - logger.Info("successfully completed one-time migration of data directory", - zap.String("details", "https://github.com/caddyserver/caddy/issues/2955")) -} |