Closed mohammed90 closed 1 month ago
I think this existed to deal with https://github.com/caddyserver/caddy/pull/5919#discussion_r1425560197 i.e. Caddyfile.yaml
if yaml
is loaded as an adapter, should use that instead of the Caddyfile adapter.
I think this existed to deal with #5919 (comment) i.e.
Caddyfile.yaml
ifyaml
is loaded as an adapter, should use that instead of the Caddyfile adapter.
They would have specified the --adapter
flag. I've added a comment.
Are you sure though? The point of this is to presume when the Caddyfile is being used: Caddyfile.yaml
is clearly ambiguous (and incorrect, since a yaml file isn't Caddyfile, and a Caddyfile isn't yaml) -- what happens if they don't use the --adapter
flag? Do we presume Caddyfile or YAML?
what happens if they don't use the
--adapter
flag? Do we presume Caddyfile or YAML?
I can add a condition for such pesky scenarios 🙂
if adapterName == "" && startsOrEndsInCaddyfile {
return nil, "", fmt.Error("ambiguous... blablabbla")
}
Ok, yeah, that sounds better. Maybe an error is better than ignoring it like we were doing. (But yeah, it's still important that we don't proceed, either way.)
With this new modification, in version 2.8.2 my Caddyfile isn't recognized anymore. I need to force it using -c Caddyfile --adapter caddyfile. If not i get ambigous config message error. Same Caddyfile works without problems in 2.8.1
With this new modification, in version 2.8.2 my Caddyfile isn't recognized anymore. I need to force it using -c Caddyfile --adapter caddyfile. If not i get ambigous config message error. Same Caddyfile works without problems in 2.8.1
My bad. Let me work on the fix. I'm sorry.
official website mentions Caddyfile
as config name (note the cap C
), but since this change 'Caddyfile' will produce error. You may need to modify the documents of your official website or add Caddyfile
to this line startsOrEndsInCaddyfile := strings.HasPrefix(baseConfig, "caddyfile") || strings.HasSuffix(baseConfig, ".caddyfile")
You may need to modify the documents of your official website
That's not necessary. It's a regression. Please see the linked PR.
Aha! I knew it; appreciate the very quick fix!
Fix #6355