Skip to content

Commit

Permalink
Remove pre 0.9 code (#1304)
Browse files Browse the repository at this point in the history
* Remove pre 0.9 code

* Unused import

* gofmtw
  • Loading branch information
wendigo authored and mholt committed Dec 27, 2016
1 parent e641d2f commit d5fe492
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 56 deletions.
48 changes: 0 additions & 48 deletions caddy/caddymain/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
Expand Down Expand Up @@ -92,8 +91,6 @@ func Run() {
os.Exit(0)
}

moveStorage() // TODO: This is temporary for the 0.9 release, or until most users upgrade to 0.9+

// Set CPU cap
err := setCPU(cpu)
if err != nil {
Expand Down Expand Up @@ -166,51 +163,6 @@ func defaultLoader(serverType string) (caddy.Input, error) {
}, nil
}

// moveStorage moves the old certificate storage location by
// renaming the "letsencrypt" folder to the hostname of the
// CA URL. This is TEMPORARY until most users have upgraded to 0.9+.
func moveStorage() {
oldPath := filepath.Join(caddy.AssetsPath(), "letsencrypt")
_, err := os.Stat(oldPath)
if os.IsNotExist(err) {
return
}
// Just use a default config to get default (file) storage
fileStorage, err := new(caddytls.Config).StorageFor(caddytls.DefaultCAUrl)
if err != nil {
mustLogFatalf("[ERROR] Unable to get new path for certificate storage: %v", err)
}
newPath := fileStorage.(*caddytls.FileStorage).Path
err = os.MkdirAll(string(newPath), 0700)
if err != nil {
mustLogFatalf("[ERROR] Unable to make new certificate storage path: %v\n\nPlease follow instructions at:\nhttps://github.com/mholt/caddy/issues/902#issuecomment-228876011", err)
}
err = os.Rename(oldPath, string(newPath))
if err != nil {
mustLogFatalf("[ERROR] Unable to migrate certificate storage: %v\n\nPlease follow instructions at:\nhttps://github.com/mholt/caddy/issues/902#issuecomment-228876011", err)
}
// convert mixed case folder and file names to lowercase
var done bool // walking is recursive and preloads the file names, so we must restart walk after a change until no changes
for !done {
done = true
filepath.Walk(string(newPath), func(path string, info os.FileInfo, err error) error {
// must be careful to only lowercase the base of the path, not the whole thing!!
base := filepath.Base(path)
if lowerBase := strings.ToLower(base); base != lowerBase {
lowerPath := filepath.Join(filepath.Dir(path), lowerBase)
err = os.Rename(path, lowerPath)
if err != nil {
mustLogFatalf("[ERROR] Unable to lower-case: %v\n\nPlease follow instructions at:\nhttps://github.com/mholt/caddy/issues/902#issuecomment-228876011", err)
}
// terminate traversal and restart since Walk needs the updated file list with new file names
done = false
return errors.New("start over")
}
return nil
})
}
}

// setVersion figures out the version information
// based on variables set by -ldflags.
func setVersion() {
Expand Down
9 changes: 1 addition & 8 deletions caddyhttp/proxy/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
)

var (
supportedPolicies = make(map[string]func() Policy)
warnedProxyHeaderDeprecation bool // TODO: Temporary, until proxy_header is removed entirely
supportedPolicies = make(map[string]func() Policy)
)

type staticUpstream struct {
Expand Down Expand Up @@ -296,12 +295,6 @@ func parseBlock(c *caddyfile.Dispenser, u *staticUpstream) error {
return err
}
u.HealthCheck.Timeout = dur
case "proxy_header": // TODO: deprecate this shortly after 0.9
if !warnedProxyHeaderDeprecation {
fmt.Println("WARNING: proxy_header is deprecated and will be removed soon; use header_upstream instead.")
warnedProxyHeaderDeprecation = true
}
fallthrough
case "header_upstream":
var header, value string
if !c.Args(&header, &value) {
Expand Down

0 comments on commit d5fe492

Please sign in to comment.