Browse Source
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.
master
Matthew Holt
6 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
1 changed files with
3 additions and
1 deletions
-
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
|
|
|
// as a special case, if a config file called "Caddyfile" was
|
|
|
// specified, and no adapter is specified, assume caddyfile adapter
|
|
|
// specified, and no adapter is specified, assume caddyfile adapter
|
|
|
// for convenience
|
|
|
// for convenience
|
|
|
if filepath.Base(configFile) == "Caddyfile" && adapterName == "" { |
|
|
if strings.HasPrefix(filepath.Base(configFile), "Caddyfile") && |
|
|
|
|
|
filepath.Ext(configFile) != ".json" && |
|
|
|
|
|
adapterName == "" { |
|
|
adapterName = "caddyfile" |
|
|
adapterName = "caddyfile" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|