summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-01-11 13:48:29 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2020-01-11 13:48:29 -0700
commit8c0c1a7b8815866ac3b6c9cf100f18bf2f1bbd6d (patch)
treef28fa235d1f969c3414cc0ebb338b01763f3215d /cmd
parent25dea2903e613534e00a2a4e305e0c8f2daeea8d (diff)
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.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/main.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/main.go b/cmd/main.go
index d8e5f7b..54d11d8 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -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"
}