mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 08:57:40 +08:00
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.
This commit is contained in:
parent
25dea2903e
commit
8c0c1a7b88
|
@ -137,7 +137,9 @@ func loadConfig(configFile, adapterName string) ([]byte, error) {
|
|||
// as a special case, if a config file called "Caddyfile" was
|
||||
// specified, and no adapter is specified, assume caddyfile adapter
|
||||
// for convenience
|
||||
if filepath.Base(configFile) == "Caddyfile" && adapterName == "" {
|
||||
if strings.HasPrefix(filepath.Base(configFile), "Caddyfile") &&
|
||||
filepath.Ext(configFile) != ".json" &&
|
||||
adapterName == "" {
|
||||
adapterName = "caddyfile"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user