Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
cmd: Assume Caddyfile if name starts with Caddyfile
And doesn't have .json extension -- in case someone names their JSON config something like Caddyfile.json, which is unconventional.
Matthew Holt committed
Jan 11, 2020 at 13:48 UTC
8c0c1a7b8815866ac3b6c9cf100f18bf2f1bbd6d
1 file changed
+3
-1
cmd/main.go
+3
-1
@@ -137,7 +137,9 @@ func loadConfig(configFile, adapterName string) ([]byte, error) {
137
// as a special case, if a config file called "Caddyfile" was
138
// specified, and no adapter is specified, assume caddyfile adapter
139
// for convenience
140
- if filepath.Base(configFile) == "Caddyfile" && adapterName == "" {
140
+ if strings.HasPrefix(filepath.Base(configFile), "Caddyfile") &&
141
+ filepath.Ext(configFile) != ".json" &&
142
+ adapterName == "" {
143
adapterName = "caddyfile"
144
}
145